0

I am trying to install jenssegers Laravel-MongoDB bundle. (https://github.com/jenssegers/Laravel-MongoDB)

When I try composer update I get following error:

"error":{"type:"ReflectionException","message":"Classs db does not exist","file":"C:\\wamp\\www\\projectname\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php","line":308}} Script php artisan clear-compiled handling the post-update-cmd event returned with an error

My composer.json file looks like this:

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",

    "require": {
        "laravel/framework": "4.0.*",
        "jenssegers/mongodb": "*"       
    },
    "autoload": {
        "classmap": [
            "app/commands",
            "app/controllers",
            "app/models",
            "app/database/migrations",
            "app/database/seeds",
            "app/tests/TestCase.php"
        ]
    },
    "scripts": {
        "post-install-cmd": [
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "php artisan clear-compiled",
            "php artisan optimize"
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ]
    },
    "config": {
        "preferred-install": "dist"
    },
    "minimum-stability": "dev"
}

Any suggestions how to fix this?

Gaurav Dave
  • 6,838
  • 9
  • 25
  • 39
higert
  • 1
  • 2

4 Answers4

0

like this

    'Illuminate\Validation\ValidationServiceProvider',
    'Illuminate\View\ViewServiceProvider',
    'Illuminate\Workbench\WorkbenchServiceProvider',

    'Jenssegers\Mongodb\MongodbServiceProvider',
0

Are you using db instead of DB in code? Use the uppercase DB. Also, check to see if you need to use \DB instead of DB, which would be due to attempting to use the DB facade within another non-global namespace.

shaggy
  • 205
  • 3
  • 5
0

You need to do only the following commands for the successful installation. It worked for me.

For installing MongoDB follow

->sudo -s ->apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list

->apt-get update ->apt-get -y install mongodb-org

->grep -q "extension=mongo.so" /etc/php5/apache2/php.ini || echo "extension=mongo.so" >> /etc/php5/apache2/php.ini

->grep -q "extension=mongo.so" /etc/php5/cli/php.ini || echo "extension=mongo.so" >> /etc/php5/cli/php.ini && pecl install mongo

->echo "extension=mongo.so" >> /etc/php5/cli/php.ini

->service apache2 restart

Then move to the laravel directory and run following command

->composer require jenssegers/mongodb

Then follow this page.

Nithil George
  • 275
  • 7
  • 25
0

You must install MongoDB You can find installation instructions at http://docs.mongodb.org/manual/installation

and then install MongoDB PHP driver. You can find installation instructions at http://php.net/manual/en/mongo.installation.php