I am not able to integrate mongoDB is laravel project. Installation of ‘jenssegers/mongodb’ Package in the project fails. Following are the error prints.
Output of command composer require jenssegers/mongodb
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Conclusion: don't install jenssegers/mongodb v3.6.3
- Conclusion: don't install jenssegers/mongodb v3.6.2
- Conclusion: don't install jenssegers/mongodb v3.6.1
- Conclusion: remove laravel/framework v7.5.1
- Installation request for jenssegers/mongodb ^3.6 -> satisfiable by jenssegers/mongodb[v3.6.0, v3.6.1, v3.6.2, v3.6.3].
- Conclusion: don't install laravel/framework v7.5.1
- jenssegers/mongodb v3.6.0 requires illuminate/events ^5.8|^6.0 -> satisfiable by illuminate/events[5.8.x-dev, 6.x-dev, v5.8.0, v5.8.11, v5.8.12, v5.8.14, v5.8.15, v5.8.17, v5.8.18, v5.8.19, v5.8.2, v5.8.20, v5.8.22, v5.8.24, v5.8.27, v5.8.28, v5.8.29, v5.8.3, v5.8.30, v5.8.31, v5.8.32, v5.8.33, v5.8.34, v5.8.35, v5.8.36, v5.8.4, v5.8.8, v5.8.9, v6.0.0, v6.0.1, v6.0.2, v6.0.3, v6.0.4, v6.1.0, v6.10.0, v6.11.0, v6.12.0, v6.13.0, v6.13.1, v6.14.0, v6.15.0, v6.15.1, v6.16.0, v6.17.0, v6.17.1, v6.18.0, v6.18.1, v6.18.2, v6.18.3, v6.18.4, v6.18.5, v6.2.0, v6.3.0, v6.4.1, v6.5.0, v6.5.1, v6.5.2, v6.6.0, v6.6.1, v6.6.2, v6.7.0, v6.8.0].
- don't install illuminate/events 5.8.x-dev|don't install laravel/framework v7.5.1
- don't install illuminate/events 6.x-dev|don't install laravel/framework v7.5.1
- don't install illuminate/events v5.8.0|don't install laravel/framework v7.5.1
- don't install illuminate/events v5.8.11|don't install laravel/framework v7.5.1
- don't install illuminate/events v5.8.12|don't install laravel/framework v7.5.1
- don't install illuminate/events v5.8.14|don't install laravel/framework v7.5.1
- don't install illuminate/events v5.8.15|don't install laravel/framework v7.5.1
- don't install illuminate/events v5.8.17|don't install laravel/framework v7.5.1
- don't install illuminate/events v5.8.18|don't install laravel/framework v7.5.1
- don't install illuminate/events v5.8.19|don't install laravel/framework v7.5.1
- don't install illuminate/events v5.8.2|don't install laravel/framework v7.5.1
- don't install illuminate/events v5.8.20|don't install laravel/framework v7.5.1
- don't install illuminate/events v5.8.22|don't install laravel/framework v7.5.1
- don't install illuminate/events v5.8.24|don't install laravel/framework v7.5.1
- don't install illuminate/events v5.8.27|don't install laravel/framework v7.5.1
- don't install illuminate/events v5.8.28|don't install laravel/framework v7.5.1
- don't install illuminate/events v5.8.29|don't install laravel/framework v7.5.1
- don't install illuminate/events v5.8.3|don't install laravel/framework v7.5.1
- don't install illuminate/events v5.8.30|don't install laravel/framework v7.5.1
- don't install illuminate/events v5.8.31|don't install laravel/framework v7.5.1
- don't install illuminate/events v5.8.32|don't install laravel/framework v7.5.1
- don't install illuminate/events v5.8.33|don't install laravel/framework v7.5.1
- don't install illuminate/events v5.8.34|don't install laravel/framework v7.5.1
- don't install illuminate/events v5.8.35|don't install laravel/framework v7.5.1
- don't install illuminate/events v5.8.36|don't install laravel/framework v7.5.1
- don't install illuminate/events v5.8.4|don't install laravel/framework v7.5.1
- don't install illuminate/events v5.8.8|don't install laravel/framework v7.5.1
- don't install illuminate/events v5.8.9|don't install laravel/framework v7.5.1
- don't install illuminate/events v6.0.0|don't install laravel/framework v7.5.1
- don't install illuminate/events v6.0.1|don't install laravel/framework v7.5.1
- don't install illuminate/events v6.0.2|don't install laravel/framework v7.5.1
- don't install illuminate/events v6.0.3|don't install laravel/framework v7.5.1
- don't install illuminate/events v6.0.4|don't install laravel/framework v7.5.1
- don't install illuminate/events v6.1.0|don't install laravel/framework v7.5.1
- don't install illuminate/events v6.2.0|don't install laravel/framework v7.5.1
- don't install illuminate/events v6.3.0|don't install laravel/framework v7.5.1
- don't install illuminate/events v6.4.1|don't install laravel/framework v7.5.1
- don't install illuminate/events v6.5.0|don't install laravel/framework v7.5.1
- don't install illuminate/events v6.5.1|don't install laravel/framework v7.5.1
- don't install illuminate/events v6.5.2|don't install laravel/framework v7.5.1
- don't install illuminate/events v6.6.0|don't install laravel/framework v7.5.1
- don't install illuminate/events v6.6.1|don't install laravel/framework v7.5.1
- don't install illuminate/events v6.6.2|don't install laravel/framework v7.5.1
- don't install illuminate/events v6.7.0|don't install laravel/framework v7.5.1
- don't install illuminate/events v6.8.0|don't install laravel/framework v7.5.1
- Installation request for laravel/framework (locked at v7.5.1, required as ^7.0) -> satisfiable by laravel/framework[v7.5.1].
Installation failed, reverting ./composer.json to its original content.
Laravel framewok verion – php artisan –version -> Laravel Framework 7.5.1
MongoDB version -> 4.0.5
PHP version -> 7.4.3
6
Answers
Before package installation you need to install PHP driver for MongoDB. You can install it by
pecl
as follows:For more detailed info you can see here.
next you can run your mongodb by this command:
For windows and mac, you can their own alternatives.
It seems like
jenssegers/mongodb
in it’s current form only supports the illuminate-ecosystem (and therefore Laravel) up to version 6.Therefore you’d have to downgrade laravel to the newest version in the 6-range.
7 is just available since 5 weeks, so it may take some time until other packages in the eco-system have updated version constraints.
Try – composer require jenssegers/mongodb dev-develop
As it might still be under development for laravel version 7
I had the same problem. After checking their Github issues, I got the below solution which worked for me.
Had the same problem even after running
composer require jenssegers/mongodb:dev-develop
doing this helped me:
composer require jenssegers/mongodb:dev-develop --ignore-platform-reqs
Don’t know the pros and cons of it, but this worked for me.
composer require jenssegers/mongodb:*