leroy-merlin-br / mongolid by diegofelix

Easy, powerful and ultrafast ODM for PHP and MongoDB.
Package Data
Maintainer Username: diegofelix
Maintainer Contact: zizaco@gmail.com (Zizaco Zizuini)
Package Create Date: 2013-05-01
Package Last Update: 2023-03-30
Home Page:
Language: PHP
License: MIT
Last Refreshed: 2023-03-31 03:20:22
Package Statistics
Total Downloads: 24,775
Monthly Downloads: 629
Daily Downloads: 51
Total Stars: 102
Total Watchers: 27
Total Forks: 25
Total Open Issues: 18

Mongolid ODM for MongoDB (PHP7)

Easy, powerful and ultrafast ODM for PHP7 build on top of the new mongodb driver.


Mongolid supports both ActiveRecord and DataMapper patterns. You choose! (:

Build Status Codacy Badge StyleCI Coverage Status Latest Stable Version Total Downloads Latest Unstable Version License



Mongolid ODM (Object Document Mapper) provides a beautiful, simple implementation for working with MongoDB. Each database collection can have a corresponding "Model" which is used to interact with that collection.

Note: If you are working with Laravel, take a look at mongolid-laravel repository.


You can install library through Composer:

$ composer require leroy-merlin-br/mongolid


Note: If you are looking for the old PHP 5.x version, head to the v0.8 branch.

Read the Docs: leroy-merlin-br.github.com/mongolid

Mongolid Docs


"PHP Fatal error: Class 'MongoDB\Client' not found in ..."

The MongoDB\Client class is contained in the new MongoDB driver for PHP. Here is an installation guide. The driver is a PHP extension written in C and maintained by MongoDB. Mongolid and most other MongoDB PHP libraries utilize it in order to be fast and reliable.

"Class 'MongoDB\Client' not found in ..." in CLI persists even with MongoDB driver installed.

Make sure that the php.ini file used in the CLI environment includes the MongoDB extension. In some systems, the default PHP installation uses different .ini files for the web and CLI environments.

Run php -i | grep 'Configuration File' in a terminal to check the .ini that is being used.

To check if PHP in the CLI environment is importing the driver properly run php -i | grep -i 'mongo' in your terminal. You should get output similar to:

$ php -i | grep -i 'mongo'
MongoDB support => enabled
MongoDB extension version => 1.2.8
MongoDB extension stability => stable
libmongoc bundled version => 1.5.5

"This package requires php >=7.0 but your PHP version (X.X.X) does not satisfy that requirement."

The new (and improved) version 2.0 of Mongolid requires php7. If you are looking for the old PHP 5.x version, head to the v0.8 branch.


Mongolid is free software distributed under the terms of the MIT license

Additional information

Mongolid was proudly built by the Leroy Merlin Brazil team. See all the contributors.

Any questions, feel free to contact us.

Any issues, please report here