PHPackages                             mongator/mongator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. mongator/mongator

ActiveLibrary[Database &amp; ORM](/categories/database)

mongator/mongator
=================

Mongator is a easy, powerful and ultrafast ODM for PHP and MongoDB. (forked from Mandango project)

v1.5.2(11y ago)343.7k12[3 issues](https://github.com/mongator/mongator/issues)2MITPHPPHP &gt;=5.3.0

Since Oct 26Pushed 11y ago6 watchersCompare

[ Source](https://github.com/mongator/mongator)[ Packagist](https://packagist.org/packages/mongator/mongator)[ Docs](http://mongator.com)[ RSS](/packages/mongator-mongator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (18)Used By (2)

[![Mongator ODM](https://camo.githubusercontent.com/1674c3990dfef414836de776bceb65e3c30eb6c15830f1fc79f7cc65a1789d9e/687474703a2f2f73382e706f7374696d672e6f72672f70676b696a376736642f6c6f676f2e706e67)](https://camo.githubusercontent.com/1674c3990dfef414836de776bceb65e3c30eb6c15830f1fc79f7cc65a1789d9e/687474703a2f2f73382e706f7374696d672e6f72672f70676b696a376736642f6c6f676f2e706e67)

Mongator [![Build Status](https://camo.githubusercontent.com/1a07b2835e03bbb8f4c74e2719b1753aa44c1794155908c5bb1f6a209cf2958c/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f6d6f6e6761746f722f6d6f6e6761746f722e706e67)](http://travis-ci.org/mongator/mongator)
============================================================================================================================================================================================================================================================================

[](#mongator-)

Mongator is to the ODMs what Mongo is to databases.

- **Simple**: Mongator is developed in a simple way. This makes it very easy to learn, use, and avoid bugs.
- **Powerful**: Mongator is very flexible thanks to Mondator, so you'll be able to use it to develop any type of application.
- **Ultrafast**: Mongator has been designed to be extremely light in memory consumption and processing cost.

¿Aren't you convinced yet? Let me show you a few more features:

- **References and Embeds**: Mongator allows you to work with \[references and embeds\] very easily.
- **Extensions**: Mongator can be customized infinitely with Mondator Extensions.
- **Indexes**: Mongator allows you to work easily with the \[indexes\] of the collections.
- **Events**: Mongator throws *hooks* before and after inserting, updating, saving and deleting documents.
- **GridFS**: Mongator allows to save files of any size using \[GridFS\].
- **Log**: Mongator allows to save logs of the queries to improve the development.
- **batchInsert**: Mongator uses \[batchInsert\] to insert documents in an efficient way.
- **Atomic Operations**: Mongator uses \[atomic operations\] to update and delete documents efficiently.
- **Integratión with IDEs**: Mongator uses generated code, so you may integrate it with your IDE.
- **Tested**: Mongator is completely tested with automated test with \[PHPUnit\].

> Mongator is **the fastest mapper** in PHP by far. More information in the \[performance comparison\].

Requirements
------------

[](#requirements)

- PHP 5.3.x;
- ext-mongo &gt; 1.2.11

Installation
------------

[](#installation)

The recommended way of installing Mongator is [through composer](http://getcomposer.org). You can see [package information on Packagist.](https://packagist.org/packages/mongator/mongator)

```
{
    "require": {
        "mongator/mongator": "1.4.*"
    }
}
```

Examples
--------

[](#examples)

```
$query = $articleRepository->createQuery(); // Model\ArticleQuery
$query = $articleRepository->createQuery($criteria);

// methods (fluent interface)
$query
    ->criteria(array('is_active' => true))
    ->fields(array('title' => 1))
    ->sort(array('date' => -1))
    ->limit(10)
    ->skip(25)
    ->batchSize(3)
    ->hint(array('date' => 1))
    ->slaveOkay(true)
    ->snapshot(true)
    ->timeout(100)

    ->references() // Mongator's extra
;

// the real query is only executed in these cases
foreach ($query as $result) { // iterating (IteratorAggregate interface)
}
$articles = $query->all(); // retrieving all results explicitly
$article = $query->one(); // retrieving one result  explicitly

// counting results (directly, without hydrate)
$nb = $query->count();
$nb = count($query); // Countable interface
```

Tests
-----

[](#tests)

Tests are in the `tests` folder. To run them, you need PHPUnit. Example:

```
$ phpunit --configuration phpunit.xml.dist

```

Benchmarking
------------

[](#benchmarking)

A small suite of benchmarking is included with the package, you can run the suite with this command:

```
php ./vendor/bin/athletic -b tests/bootstrap.php  -p tests/Mongator/Benchmarks/
```

Some results can be find at:

License
-------

[](#license)

MIT, see [LICENSE](LICENSE)

###  Health Score

38

—

LowBetter than 84% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community26

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~39 days

Recently: every ~12 days

Total

16

Last Release

4352d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2731762b7c1dc9e30dbd878c0f03cb99410ad894a6996f98d132047f8885d00d?d=identicon)[mcuadros](/maintainers/mcuadros)

---

Top Contributors

[![mcuadros](https://avatars.githubusercontent.com/u/1573114?v=4)](https://github.com/mcuadros "mcuadros (152 commits)")[![pablodip](https://avatars.githubusercontent.com/u/98504?v=4)](https://github.com/pablodip "pablodip (137 commits)")[![dripolles](https://avatars.githubusercontent.com/u/768061?v=4)](https://github.com/dripolles "dripolles (44 commits)")[![AntonStoeckl](https://avatars.githubusercontent.com/u/776322?v=4)](https://github.com/AntonStoeckl "AntonStoeckl (13 commits)")[![johnwards](https://avatars.githubusercontent.com/u/34269?v=4)](https://github.com/johnwards "johnwards (5 commits)")[![brikou](https://avatars.githubusercontent.com/u/383212?v=4)](https://github.com/brikou "brikou (2 commits)")[![ivannis](https://avatars.githubusercontent.com/u/754477?v=4)](https://github.com/ivannis "ivannis (1 commits)")[![dpordomingo](https://avatars.githubusercontent.com/u/2437584?v=4)](https://github.com/dpordomingo "dpordomingo (1 commits)")[![amartinj](https://avatars.githubusercontent.com/u/1821052?v=4)](https://github.com/amartinj "amartinj (1 commits)")[![jfbus](https://avatars.githubusercontent.com/u/808338?v=4)](https://github.com/jfbus "jfbus (1 commits)")

---

Tags

odmmongodb

### Embed Badge

![Health badge](/badges/mongator-mongator/health.svg)

```
[![Health](https://phpackages.com/badges/mongator-mongator/health.svg)](https://phpackages.com/packages/mongator-mongator)
```

###  Alternatives

[doctrine/mongodb-odm

PHP Doctrine MongoDB Object Document Mapper (ODM) provides transparent persistence for PHP objects to MongoDB.

1.1k23.3M301](/packages/doctrine-mongodb-odm)[sokil/php-mongo

PHP Object Document Mapper for MongoDB

239161.5k9](/packages/sokil-php-mongo)[mmucklo/queue-bundle

Symfony2/3/4/5 Queue Bundle (for background jobs) supporting Mongo (Doctrine ODM), Mysql (and any Doctrine ORM), RabbitMQ, Beanstalkd, Redis, and ... {write your own}

120839.8k](/packages/mmucklo-queue-bundle)[doctrine/doctrine-mongo-odm-module

Laminas Module which provides Doctrine MongoDB ODM functionality

86676.6k35](/packages/doctrine-doctrine-mongo-odm-module)[leroy-merlin-br/mongolid

Easy, powerful and ultrafast ODM for PHP and MongoDB.

11234.3k4](/packages/leroy-merlin-br-mongolid)[abellion/xenus

Xenus : A MongoDB ODM

3464.5k1](/packages/abellion-xenus)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
