Docs Menu
Docs Home
/ / /
Laravel MongoDB
/

Download and Install

To create the Quick Start application, you need the following software installed in your development environment:

  • PHP

  • Composer

  • A terminal app and shell. For MacOS users, use Terminal or a similar app. For Windows users, use PowerShell.

Complete the following steps to install and add the Laravel Integration dependencies to a Laravel web application.

Tip

As an alternative to the following installation steps, you can use Laravel Herd to install MongoDB and configure a Laravel MongoDB development environment. For more information about using Laravel Herd with MongoDB, see the following resources:

1

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.

2

Ensure that the version of Laravel you install is compatible with the version of the Laravel Integration. 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
3

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!
4

Navigate to the application directory you created in the previous step:

cd my-app

Run the following command to add the Laravel application encryption key, which is required to encrypt cookies:

php artisan key:generate
5

Run the following command to add the Laravel MongoDB dependency to your application:

composer require mongodb/laravel-mongodb:^5.1

When the installation completes, verify that the composer.json file includes the following line in the require object:

"mongodb/laravel-mongodb": "^5.1"

After completing these steps, you have a new Laravel project with the Laravel Integration 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.

Back

Quick Start