I\'m using with latest php version 7.2 on macOS Mojave and receiving error like
$composer require mongodb/mongodb
Using version ^1.4 for mongodb/mongodb
./comp
composer require mongodb/mongodb --ignore-platform-reqs
composer require mongodb/mongodb --ignore-platform-reqs
composer require jenssegers/mongodb --ignore-platform-reqs
Using version ^3.4 for jenssegers/mongodb
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 2 installs, 0 updates, 0 removals
- Installing mongodb/mongodb (1.4.2): Downloading (100%)
- Installing jenssegers/mongodb (v3.4.5): Downloading (100%)
jenssegers/mongodb suggests installing jenssegers/mongodb-session (Add MongoDB session support to Laravel-MongoDB)
jenssegers/mongodb suggests installing jenssegers/mongodb-sentry (Add Sentry support to Laravel-MongoDB)
Writing lock file
Generating optimized autoload files
composer require jenssegers/mongodb --ignore-platform-reqs
It solved my problem.
Im using PHP Version 7.4.4(XAMPP for Linux 7.4.4) on Ubuntu 18.0.4 (Bionic) The following command solved my issue
composer require mongodb/mongodb --ignore-platform-reqs
Install PHP extension by running this command on your terminal.
sudo pecl install mongodb
At the end, you will see following information.
Build process completed successfully
Installing '/usr/local/Cellar/php/7.3.3/pecl/20180731/mongodb.so'
install ok: channel://pecl.php.net/mongodb-1.5.3
Extension mongodb enabled in php.ini
and then restart your PHP service.