Laravel, laravel-mongodb, Laravel Forge, and PHP 7

Oookay, so for some reason the mix from the title was a big deal. When you try to install laravel-mongodb package on servers created by Laravel Homestead or Forge – it’s going to fail. To be specific, when you try to run:

composer require jenssegers/mongodb

composer is going to start bitching about missing mongodb php extension. And you can’t install it until you run:

sudo apt-get install libcurl4-openssl-dev

Then you’ll be good to go. Install the new mongodb extension by running:

sudo pecl install mongodb

and then add the following line to your php.ini file (probably /etc/php/7.0/cli/php.ini & /etc/php/7.0/fpm/php.ini):

extension=mongodb.so

That should be it. Don’t forget to restart nginx.