Download and Install
Prerequisites
To create the Quick Start application, you need the following software installed in your development environment:
Download and Install the Dependencies
Complete the following steps to install and add the Laravel MongoDB dependencies to a Laravel web application.
Install the MongoDB PHP Extension
Laravel MongoDB requires the MongoDB PHP Extension to manage MongoDB connections and commands. Follow the Installing the MongoDB PHP Driver with PECL guide to install the MongoDB PHP Extension.
Install Laravel
Ensure that the version of Laravel you install is compatible with the version of Laravel MongoDB. To learn which versions are compatible, see the Compatibility page.
Run the following command to install Laravel:
composer global require laravel/installer
When the installation completes, the command outputs the following message:
Using version ^<version number> for laravel/installer
Create a Laravel application
Run the following command to generate a new Laravel web application
called my-app
:
laravel new my-app
When the installation completes, the command outputs the following message:
INFO Application ready in [my-app]. You can start your local development using: ➜ cd my-app ➜ php artisan serve New to Laravel? Check out our bootcamp and documentation. Build something amazing!
Add Laravel MongoDB to the dependencies
Run the following command to add the Laravel MongoDB dependency to your application:
composer require mongodb/laravel-mongodb:^4.6
When the installation completes, verify that the composer.json
file
includes the following line in the require
object:
"mongodb/laravel-mongodb": "^4.6"
After completing these steps, you have a new Laravel project with the Laravel MongoDB dependencies installed.
Note
If you run into issues, ask for help in the MongoDB Community Forums or submit feedback by using the Rate this page tab on the right or bottom right side of the page.