4

I encountered and error when running php artisan tinker in my current project. I tried to create a new project using laravel new projectname but the same error occurs when running php artisan tinker. This is the error that occurs.


````Class 'XdgBaseDir\Xdg' not found

````at C:\xampppp\htdocs\someProject\vendor\psy\psysh\src\ConfigPaths.php:34
  ````30|      * @return string[]
  ````31|      */
  ````32|     public static function getConfigDirs()
  ````33|     {
````> 34|         $xdg = new Xdg();
  ````35|
  ````36|         return self::getDirNames($xdg->getConfigDirs());
  ````37|     }
  ````38|

````1   C:\xampppp\htdocs\someProject\vendor\psy\psysh\src\ConfigPaths.php:90
    ````Psy\ConfigPaths::getConfigDirs()

````2   C:\xampppp\htdocs\someProject\vendor\psy\psysh\src\Configuration.php:392
    ````Psy\ConfigPaths::getConfigFiles()
 

I badly need help. Thank you so much for anyone that knows the solution.
  • Unless you are using a facade, in Tinker, you have to explicitly enter the whole namespace of a class you want to use. As you can't import them, you have to mention the namespace 'on the go' in Tinker. This helper puts you into your framework right after the boot process is done. Technically, there is no server request. No route. No controller. No view. It's a handy helper I use a lot too. But it has it's natural limitations. – Dimitri Mostrey Aug 04 '20 at 09:28
  • Thank you so much. Will look at facade if I can use this. Tried to use homestead in vagrant but error persisted. Will go for facade. Thank you so much. – Pseudoman21 Aug 05 '20 at 06:50

3 Answers3

1

Finally found the solution. I ask my senior if I can copy his vendor files and a composer update followed. What a relief. Thank you still. Peace out!

(Edit)

If you have a working vendor files, you can copy and paste it to the project files folder where you encounter the said error above. Then do a composer update and your all set.

1

try this one it worked for me probably you don't have the package installed in the vendor

composer require dnoegel/php-xdg-base-dir
Ahmed
  • 11
  • 1
1

I only had to run composer update