Mondoc is an easy-to-use PHP library, providing a database abstraction layer for MongoDB.
Installation
The Mondoc library is based around a model and service architecture. A MongoDB document is represented by a model, which is a class that extends the MondocAbstractModel, and the MongoDB collection is represented by a service, which is a class that extends the MondocAbstractService.
Install the latest stable version of Mondoc with Composer:
composer require district5/mondoc
* Installing the Mondoc library will also install the Mondoc Builder and Mondoc Encryption libraries.
Or alternatively, you can just install the standalone MondocBuilder package for query building:
composer require district5/mondoc-builder
* MondocBuilder is a dependency of Mondoc, but MondocBuilder can be standalone, and does not require Mondoc.
Quick start
After installing Mondoc via Composer, you'll need to set up MondocConfig with your MongoDB connection details. Our quick start guide will walk you through the process.
Latest releases
The Mondoc library is actively maintained and regularly updated. Below are the latest releases of the Mondoc library and its dependencies.
- open_in_new Mondoc - The main library for MongoDB database abstraction.
- open_in_new Mondoc Encryption - A library for encrypting and decrypting MongoDB documents.
- open_in_new Mondoc Builder - A standalone library for building MongoDB queries.
------------------------------------------------------------------------------------------ | Library | Latest release | Released | Composer package | ------------------------------------------------------------------------------------------ | Mondoc | 7.6.0 | 2025-06-01 08:34:04 | district5/mondoc | | Mondoc Encryption | 1.0.2 | 2025-05-16 07:43:42 | district5/mondoc-encryption | | Mondoc Builder | 2.3.0 | 2025-05-10 06:49:22 | district5/mondoc-builder | ------------------------------------------------------------------------------------------
Contributing to Mondoc
If you find a bug or have a feature request, please consider opening an issue on description GitHub , or even better, submit a pull request.
We welcome contributions to Mondoc. The rules are simple:
1. Be considerate and maintain backward compatibility for new features (where feasible) 2. Ensure the test suite passes 3. Implement any tests, to demonstrate that your changes work 4. Write clear and concise commit messages 5. Submit a pull request, where you describe the changes you've made and why
License
Mondoc is licensed under the MIT license. You are free to use it in your projects, commercial or otherwise. If you find a bug or have a feature request, please consider opening an issue on GitHub, or even better, submit a pull request.
Copyright (c) 2021-present District5 Ltd Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.