Class 'Jenssegers\Mongodb\MongodbServiceProvider' not found

11,282

Solution 1

run composer dump-autoload or php artisan optimize

Solution 2

I didn't have the archive: myproject/vendor/jenssegers.

I installed this archive by command:

$ composer require jenssegers/mongodb

Solution 3

Delete Following Files and Use This Step :

composer.lock

bootstrap/cache/config.php

if exist

bootstrap/cache/services.php

then Run this command :

composer install

php artisan config:cache

Share:
11,282
George Chumburidze
Author by

George Chumburidze

Updated on June 14, 2022

Comments

  • George Chumburidze
    George Chumburidze almost 2 years

    I want to use https://github.com/jenssegers/laravel-mongodb for connecting to Mongodb with laravel 5, i have installed MongoDB php driver and then laravel-mongodb with command composer require jenssegers/mongodb, then added service provider in app/config/app.php:

    'Jenssegers\Mongodb\MongodbServiceProvider',
    

    and refreshed my website, unfortunately i got error ->

    FatalErrorException in compiled.php line 6466:
    Class 'Jenssegers\Mongodb\MongodbServiceProvider' not found
    

    how can i fix it?

  • George Chumburidze
    George Chumburidze about 9 years
    i have used composer dump -o composer dump-autoload and both of this functions worked but no success
  • George Chumburidze
    George Chumburidze about 9 years
    php artisan optimize got error 'could not open file artisan'
  • darioguarascio
    darioguarascio about 9 years
    you should be in your project root directory, where the file artisan is located. Anyway, try to remove the compiled.php file, and refresh the page
  • darioguarascio
    darioguarascio about 9 years
    also, do you have the file vendor/jenssegers/mongodb/src/Jenssegers/Mongodb/MongodbServ‌​iceProvider.php ?
  • George Chumburidze
    George Chumburidze about 9 years
    there is not jenssegers in vendors folder ... it seem i have installed it in another folder how can i install it in desired directory ?
  • darioguarascio
    darioguarascio about 9 years
    assuming you are under unix, go to your desired folder, then run: composer require jenssegers/mongodb be sure to be in the same directory of the artisan file
  • Ashish
    Ashish over 5 years
    getting same error and i m in same directory where artisan file available