PHPackages                             phpmongokit/yii2-mongo-odm - 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. phpmongokit/yii2-mongo-odm

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

phpmongokit/yii2-mongo-odm
==========================

PHPMongo Yii2 Adapter

0.1.1(8y ago)41.6k[2 issues](https://github.com/PHPMongoKit/yii2-mongo-odm/issues)MITPHP

Since Jan 5Pushed 8y ago2 watchersCompare

[ Source](https://github.com/PHPMongoKit/yii2-mongo-odm)[ Packagist](https://packagist.org/packages/phpmongokit/yii2-mongo-odm)[ Docs](http://phpmongokit.github.io/)[ RSS](/packages/phpmongokit-yii2-mongo-odm/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

Yii2 adapter for PHPMongo ODM
=============================

[](#yii2-adapter-for-phpmongo-odm)

Yii Adapter for [PHPMongo ORM](https://github.com/sokil/php-mongo)

[![Build Status](https://camo.githubusercontent.com/c589a31beea55142c82aa80e44aa70014e7c32e5b323d707f08875bc683d2751/68747470733a2f2f7472617669732d63692e6f72672f5048504d6f6e676f4b69742f796969322d6d6f6e676f2d6f646d2e706e673f6272616e63683d6d61737465722632)](https://travis-ci.org/PHPMongoKit/yii2-mongo-odm)[![Total Downloads](https://camo.githubusercontent.com/990581e6ccc858560b9b9f8287189768c8595772a656079c42a04bcf8ce49ddd/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7068706d6f6e676f6b69742f796969322d6d6f6e676f2d6f646d2e737667)](https://packagist.org/packages/phpmongokit/yii2-mongo-odm)[![Daily Downloads](https://camo.githubusercontent.com/bca745b70b71afbd4b8b84c4b8497d886abc20d897257c4a529af9d814d7ae1d/68747470733a2f2f706f7365722e707567782e6f72672f7068706d6f6e676f6b69742f796969322d6d6f6e676f2d6f646d2f642f6461696c79)](https://packagist.org/packages/phpmongokit/yii2-mongo-odm/stats)

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

[](#requirements)

- PHP 5
    - PHP 5.3 - PHP 5.6
    - [PHP Mongo Extension](https://pecl.php.net/package/mongo) 0.9 or above (Some features require &gt;= 1.5)
- PHP 7 and HHVM
    - [PHP MongoDB Extension](https://pecl.php.net/package/mongodb) 1.0 or above
    - [Compatibility layer](https://github.com/alcaeus/mongo-php-adapter). Please, note some [restriontions](#compatibility-with-php-7)
    - HHVM Driver [not supported](https://derickrethans.nl/mongodb-hhvm.html).
- Tested over MongoDB v.2.4.12, v.2.6.9, v.3.0.2, v.3.2.10, v.3.3.15, v.3.4.0. See [Unit tests](#unit-tests) for details

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

[](#installation)

You can install library through Composer:

```
composer require phpmongokit/yii2-mongo-odm

```

#### Compatibility with PHP 7

[](#compatibility-with-php-7)

> PHPMongo currently based on old [ext-mongo](https://pecl.php.net/package/mongo) entension. To use this ODM with PHP 7, you need to add [compatibility layer](https://github.com/alcaeus/mongo-php-adapter), which implement API of old extension over new [ext-mongodb](https://pecl.php.net/package/mongodb). To start using PHPMongo with PHP7, add requirement [alcaeus/mongo-php-adapter](https://github.com/alcaeus/mongo-php-adapter) to composer. Restrictions for using ODM with compatibility layer you can read in [known issues](https://github.com/alcaeus/mongo-php-adapter#known-issues) of original adapter.

Add adapter of old `ext-mongo` API to new `ext-mongodb`:

```
composer require alcaeus/mongo-php-adapter

```

Configuration of Client
-----------------------

[](#configuration-of-client)

```
