PHPackages                             photon/utils-mongodb - 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. photon/utils-mongodb

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

photon/utils-mongodb
====================

Collections of small tools for MongoDB.

v2.1.0(9y ago)01.3k1LGPL-2.1PHPPHP ^5.5 || ^7.0

Since Dec 8Pushed 9y ago2 watchersCompare

[ Source](https://github.com/photon/utils-mongodb)[ Packagist](https://packagist.org/packages/photon/utils-mongodb)[ Docs](http://www.photon-project.com/)[ RSS](/packages/photon-utils-mongodb/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (2)Versions (7)Used By (1)

utils-mongodb
=============

[](#utils-mongodb)

[![Build Status](https://camo.githubusercontent.com/206a6d8fbaafc059f1208666a079effbd83f642076dd31542bba54276283a540/68747470733a2f2f7472617669732d63692e6f72672f70686f746f6e2f7574696c732d6d6f6e676f64622e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/photon/utils-mongodb)

Various useful tools for MongoDB

PHP Versions
------------

[](#php-versions)

- 5.6, 7.0 and 7.1 are supported and tested under travis
- Use ext-mongodb and mongodb/mongodb. Do not works anymore with legacy ext-mongo

Quick start
-----------

[](#quick-start)

1. Add the module in your project

    composer require "photon/utils-mongodb:dev-master"

or for a specific version

```
composer require "photon/utils-mongodb:2.0.0"

```

2. Define a MongoDB connection in your project configuration

    'databases' =&gt; array( 'default' =&gt; array( 'engine' =&gt; '\\photon\\db\\MongoDB', 'server' =&gt; 'mongodb://localhost:27017/', 'database' =&gt; 'utils', 'options' =&gt; array( 'connect' =&gt; true, ), ), ),
3. Enjoy !

Counters
--------

[](#counters)

The counter class implement a atomic counter increment and retreive. It's a thread safe auto-increment.

1. Create a class to define a counters collection

    class MyCounter extends \\photon\\utils\\mongodb\\Counter { const database = 'default'; const collection = 'counters'; }
2. Read / Write counter

    ```
     $value = MyCounter::get('foo');     // = 0
     $value = MyCounter::inc('foo');     // = 1
     $value = MyCounter::get('bar');     // = 0
     $value = MyCounter::get('foo');     // = 1

    ```

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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 ~107 days

Recently: every ~88 days

Total

6

Last Release

3325d ago

Major Versions

v1.0.2 → v2.0.02017-04-18

### Community

Maintainers

![](https://www.gravatar.com/avatar/32f98ddde8bc7b4f6fadce6a4030a77dc6dfd8e08d8e5b122ab4cc70232f6341?d=identicon)[delkia](/maintainers/delkia)

---

Top Contributors

[![wysman](https://avatars.githubusercontent.com/u/1042272?v=4)](https://github.com/wysman "wysman (11 commits)")

---

Tags

mongodbutilsphoton

### Embed Badge

![Health badge](/badges/photon-utils-mongodb/health.svg)

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

###  Alternatives

[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k8.4M94](/packages/mongodb-laravel-mongodb)[doctrine/mongodb-odm

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

1.1k24.5M356](/packages/doctrine-mongodb-odm)[alcaeus/mongo-php-adapter

Adapter to provide ext-mongo interface on top of mongo-php-library

47012.6M74](/packages/alcaeus-mongo-php-adapter)[leroy-merlin-br/mongolid

Easy, powerful and ultrafast ODM for PHP and MongoDB.

11335.7k6](/packages/leroy-merlin-br-mongolid)[moloquent/moloquent

A MongoDB based Eloquent model and Query builder for Laravel (Moloquent)

120115.7k7](/packages/moloquent-moloquent)[doesntmattr/mongodb-migrations

Managed Database Migrations for MongoDB

23612.1k1](/packages/doesntmattr-mongodb-migrations)

PHPackages © 2026

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