

You can use a third-party repository such as the one from Ondřej Surý or install the extension directly from PECL. You can get the latest version in two ways. Ubuntu 21.04, the latest release of the distribution, has version 1.9.2 available through the official repositories. The jenssegers/laravel-mongodb package responsible for integrating MongoDB with Laravel requires you to have at least version 1.10.0 of the extension. You can install the MongoDB extension on Ubuntu, for example, by simply executing the following command: sudo apt install -y php-mongodbīut there is an issue with this method of installation. They're available through official repositories in all major Linux distributions. In most cases, installing these extensions is not that hard. If you want to use any of these database systems in your Laravel applications or your PHP applications in general, you have to install the corresponding PHP extensions.

Similar extensions also exist for relational database management systems such as MySQL, SQLite, and PostgreSQL. It is a compiled library that enables PHP applications to communicate with a MongoDB server. Installing Platform DependenciesĪt the beginning of this article, I talked about the MongoDB PHP extension.

Note: This article assumes that you have experience working with the Laravel Eloquent ORM and the query builder. In this article, I'll walk you through the entire process of setting up Laravel with MongoDB and using it as a drop-in replacement for your existing database management system. The MongoDB extension for PHP has been around since 2015, and thanks to packages like jenssegers/laravel-mongodb, it's now even easier to integrate MongoDB with Laravel. That doesn't mean you can not use Laravel and MongoDB together. Now, if you have experience working with Laravel, you should already know that Laravel doesn't support MongoDB by default. MongoDB is one of the – if not the most – popular document-oriented database management systems out there.
