PHPackages                             district5/mondoc - 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. district5/mondoc

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

district5/mondoc
================

Mondoc is a lightweight and easy to use model and service based abstraction library for MongoDB

7.6.0(11mo ago)0444↓100%2mitPHPPHP &gt;=8.2.0CI passing

Since Jan 13Pushed 3mo agoCompare

[ Source](https://github.com/district-5/php-mondoc)[ Packagist](https://packagist.org/packages/district5/mondoc)[ Docs](https://github.com/district-5/php-mondoc)[ RSS](/packages/district5-mondoc/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (5)Versions (53)Used By (2)

Mondoc, by District5
====================

[](#mondoc-by-district5)

[![CI](https://github.com/district-5/php-mondoc/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/district-5/php-mondoc/actions)[![Latest Stable Version](https://camo.githubusercontent.com/628567e7adbc17fae435a8300526070f8c64d73342efab03fbd9129fb0df91d0/687474703a2f2f706f7365722e707567782e6f72672f6469737472696374352f6d6f6e646f632f76)](https://packagist.org/packages/district5/mondoc)[![PHP Version Require](https://camo.githubusercontent.com/8a51706acdb4dcad43bec8ce5fa75213aa500520e785975bdbd3371d0bcfd81a/687474703a2f2f706f7365722e707567782e6f72672f6469737472696374352f6d6f6e646f632f726571756972652f706870)](https://packagist.org/packages/district5/mondoc)[![Codecov](https://camo.githubusercontent.com/71cfbd791d9cb76a8e6dac58c6380b8c00c1ba3a33d52fc70b5cc76dc1b29de7/68747470733a2f2f636f6465636f762e696f2f67682f64697374726963742d352f7068702d6d6f6e646f632f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/district-5/php-mondoc)

[![FOSSA Status](https://camo.githubusercontent.com/944d60a77c1a27b211969abe5a1e8bf23c4434313f9e00f240012aab1783c5bb/68747470733a2f2f6170702e666f7373612e636f6d2f6170692f70726f6a656374732f6769742532426769746875622e636f6d25324664697374726963742d352532467068702d6d6f6e646f632e7376673f747970653d736d616c6c)](https://app.fossa.com/projects/git%2Bgithub.com%2Fdistrict-5%2Fphp-mondoc?ref=badge_small)

The effortless MongoDB interaction layer for your PHP applications
------------------------------------------------------------------

[](#the-effortless-mongodb-interaction-layer-for-your-php-applications)

### Installing with composer

[](#installing-with-composer)

```
composer require district5/mondoc

```

### Documentation...

[](#documentation)

All documentation for Mondoc is available at [mondoc.district5.dev](https://mondoc.district5.dev).

#### Common topics...

[](#common-topics)

- Getting started: [mondoc.district5.dev/quick-start](https://mondoc.district5.dev/quick-start)
- Configuration: [mondoc.district5.dev/documentation/configuration](https://mondoc.district5.dev/documentation/configuration)
- Model: [mondoc.district5.dev/documentation/model](https://mondoc.district5.dev/documentation/model)
    - Nesting models: [mondoc.district5.dev/documentation/model/nested-models](https://mondoc.district5.dev/documentation/model/nested-models)
    - Helpful traits: [mondoc.district5.dev/documentation/model/traits](https://mondoc.district5.dev/documentation/model/traits)
- Service: [mondoc.district5.dev/documentation/service](https://mondoc.district5.dev/documentation/service)

Important...
------------

[](#important)

```
As of version 7.0.0, version 2.0.0 of the MongoDB driver is supported. Requires district5/date: >=3.0.4

```

Usage...
--------

[](#usage)

#### Setting up connections...

[](#setting-up-connections)

The `MondoConnections` object is a singleton. Set this up somewhere in your code to initialise the connection, and within your services you can define `protected static function getConnectionId(): string` to return the correct identifier for the relevant model.

```
