2017 © Pedro Peláez
 

library odm

Doctrine MongoDB ODM integration with Laravel. Aim to be interoperable with other frameworks.

image

cimrie/odm

Doctrine MongoDB ODM integration with Laravel. Aim to be interoperable with other frameworks.

  • Friday, May 5, 2017
  • by CImrie
  • Repository
  • 1 Watchers
  • 1 Stars
  • 44 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 17 Versions
  • 0 % Grown

The README.md

cimrie/odm

This is a package to help integrate The Doctrine MongoDb ODM into any framework of your choice. The only caveat at the moment is that by defining a cache provider, you are declaring that you use Laravel. If you use another framework, you will need to implement your own caching solution., (*1)

Laravel Setup

Go to config/app.php and add the service provider to your 'providers' section: CImrie\Odm\OdmServiceProvider::class, (*2)

Publish the configuration file: php artisan vendor:publish --tag=odm, (*3)

You can now use the default Document Manager like so:, (*4)

 <?php

 use App\Http\Controllers\Controller;
 use Doctrine\ODM\MongoDB\DocumentManager;

 class IndexController extends Controller {

     public function index(DocumentManager $documentManager) {
         // code as normal ...

         $documentManager->flush(); 
         // etc.
     }

 }

General Setup

The package is geared towards laravel, but setup for other frameworks is not impossible, and the package still makes it easier than configuring the ODM by hand., (*5)

To generate a Document Manager, you can do the following:, (*6)

<?php

use CImrie\ODM\DocumentManagerFactory;
use CImrie\ODM\Configuration\OdmConfigurationFactory;
use CImrie\ODM\Configuration\Connections\ConnectionResolver;
use CImrie\ODM\Configuration\MetaData\MetaDataRegistry;
use \CImrie\ODM\Common\Registries\ListenerRegistry;
use CImrie\ODM\Configuration\MetaData\Annotations;

$connectionFactories = [
    new \CImrie\ODM\Configuration\Connections\MongodbConnectionFactory()
];

$config = [
              'mongodb' => [
                    'driver'   => 'mongodb',
                    'host'     => 'localhost',
                    'port'     => 27017,
                    'database' => 'odm',
                    'username' => 'secretuser',
                    'password' => 'secretpass',
                    'options'  => [
                        'database' => 'admin',
                    ],
              ]
          ];

$metaDataDrivers = [
    new Annotations()
];  

$dmFactory = new DocumentManagerFactory(
      new OdmConfigurationFactory(),
      new ConnectionResolver($connectionFactories, $config),
      new MetaDataRegistry([Annotations::class]),
      null, //cache manager
      new ListenerRegistry(),
      null //logger, which can be created by extending CImrie\ODM\Logging\Logger
);

/*
 *  <!------------- WARNING -------------!>
 */
//TODO - THIS PART OF THE DOCS IS NOT COMPLETE

$dmFactory->create(new \CImrie\ODM\Common\Config(
    [

    ],
    [

    ],
    [
        'database' => [
            'connections' => [
            ]     
        ]
    ]
));

The Versions

05/05 2017

dev-master

9999999-dev https://github.com/CImrie/odm

Doctrine MongoDB ODM integration with Laravel. Aim to be interoperable with other frameworks.

  Sources   Download

MIT

The Requires

 

The Development Requires

mongodb laravel doctrine odm

05/05 2017

v0.2.10

0.2.10.0 https://github.com/CImrie/odm

Doctrine MongoDB ODM integration with Laravel. Aim to be interoperable with other frameworks.

  Sources   Download

MIT

The Requires

 

The Development Requires

mongodb laravel doctrine odm

14/03 2017

v0.2.9

0.2.9.0 https://github.com/CImrie/odm

Doctrine MongoDB ODM integration with Laravel. Aim to be interoperable with other frameworks.

  Sources   Download

MIT

The Requires

 

The Development Requires

mongodb laravel doctrine odm

03/02 2017

v0.2.8

0.2.8.0 https://github.com/CImrie/odm

Doctrine MongoDB ODM integration with Laravel. Aim to be interoperable with other frameworks.

  Sources   Download

MIT

The Requires

 

The Development Requires

mongodb laravel doctrine odm

02/02 2017

v0.2.7

0.2.7.0 https://github.com/CImrie/odm

Doctrine MongoDB ODM integration with Laravel. Aim to be interoperable with other frameworks.

  Sources   Download

MIT

The Requires

 

The Development Requires

mongodb laravel doctrine odm

02/02 2017

v0.2.6

0.2.6.0 https://github.com/CImrie/odm

Doctrine MongoDB ODM integration with Laravel. Aim to be interoperable with other frameworks.

  Sources   Download

MIT

The Requires

 

The Development Requires

mongodb laravel doctrine odm

02/02 2017

v0.2.5

0.2.5.0 https://github.com/CImrie/odm

Doctrine MongoDB ODM integration with Laravel. Aim to be interoperable with other frameworks.

  Sources   Download

MIT

The Requires

 

The Development Requires

mongodb laravel doctrine odm

01/02 2017

v0.2.4

0.2.4.0 https://github.com/CImrie/odm

Doctrine MongoDB ODM integration with Laravel. Aim to be interoperable with other frameworks.

  Sources   Download

MIT

The Requires

 

The Development Requires

mongodb laravel doctrine odm

01/02 2017

v0.2.3

0.2.3.0 https://github.com/CImrie/odm

Doctrine MongoDB ODM integration with Laravel. Aim to be interoperable with other frameworks.

  Sources   Download

MIT

The Requires

 

The Development Requires

mongodb laravel doctrine odm

01/02 2017

v0.2.2

0.2.2.0 https://github.com/CImrie/odm

Doctrine MongoDB ODM integration with Laravel. Aim to be interoperable with other frameworks.

  Sources   Download

MIT

The Requires

 

The Development Requires

mongodb laravel doctrine odm

01/02 2017

dev-develop

dev-develop https://github.com/CImrie/odm

Doctrine MongoDB ODM integration with Laravel. Aim to be interoperable with other frameworks.

  Sources   Download

MIT

The Requires

 

The Development Requires

mongodb laravel doctrine odm

30/01 2017

v0.2.1

0.2.1.0 https://github.com/CImrie/odm

Doctrine MongoDB ODM integration with Laravel. Aim to be interoperable with other frameworks.

  Sources   Download

MIT

The Requires

 

The Development Requires

mongodb laravel doctrine odm

30/01 2017

v0.2.0

0.2.0.0 https://github.com/CImrie/odm

Doctrine MongoDB ODM integration with Laravel. Aim to be interoperable with other frameworks.

  Sources   Download

MIT

The Requires

 

The Development Requires

mongodb laravel doctrine odm

27/01 2017
27/01 2017
26/01 2017
26/01 2017