Mondoc by District5 Documentation

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

Or alternatively, you can install the standalone MondocBuilder package:

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.

Next: Quick startfast_forward

Noteworthy changes

6.5.0

As of version 6.5.0, Mondoc no longer requires the use of the addDirty method. Instead, Mondoc now establishes the dirty status by calling isDirty or isDirtyField on the model. This change was made to simplify the API and make it more intuitive.

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.