Easy, powerful and ultrafast ODM for PHP and MongoDB.
- dev-master / 2.1.x-dev
This package is auto-updated.
Last update: 2020-06-28 16:02:27 UTC
Easy, powerful and ultrafast ODM for PHP7 build on top of the new mongodb driver.
Mongolid supports both ActiveRecord and DataMapper patterns. You choose! (:
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
- MongoDB Driver
Note: If you are looking for the old PHP 5.x version, head to the v0.8 branch.
"PHP Fatal error: Class 'MongoDB\Client' not found in ..."
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.
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
Any questions, feel free to contact us.
Any issues, please report here