phpmongokit/yii2-mongo-odm

0.1 2017-01-05 10:14 UTC

README

Yii Adapter for PHPMongo ORM

Total Downloads Daily Downloads

Installation

You can install library through Composer:

composer require phpmongokit/yii2-mongo-odm

Configuration of Client

<?php

return array(
    'components' => array(
        // configure mongo service
        'mongo' => array(
            'class' => 'PHPMongoKit\ODM\Adapter\Yii2\Client',
            'dsn' => 'mongodb://127.0.0.1',
            'options' => array(
                'connect' => true,
                'readPreference' => \MongoClient::RP_SECONDARY_PREFERRED,
            ),
            'defaultDatabase' => 'database_name',
            'map' => array(
                'database_name' => array(
                    'collectionName1' => '\Collection\Class1',
                    'collectionName2' => '\Collection\Class2',
                )
            )
        ),
    )
);