cimrie/odm
Larablocks Analysis
cimrie/odm works with any PHP project: the latest release (v0.2.10, May 5, 2017) doesn't depend on Laravel.
Recommendation checks
Not advisedNot advised: no release or commit in over 2 years.
- No release or commit in over 2 years
- No release in the last 12 months (last: May 5, 2017)
- 0 downloads a month (needs 10,000)
- 2 GitHub stars (needs 100)
State
Likely abandoned- No release or commit in over 2 years.
- Last stable release: May 5, 2017.
- No releases in the last 12 months.
- First released: Jan 26, 2017.
- 0 open issues on GitHub.
Data from Packagist and GitHub, checked by Larablocks on Dec 3, 2026.
| Install | |
|---|---|
composer require cimrie/odm |
|
| Latest Version: | v0.2.10 |
| License: | MIT |
| Last Updated: | May 5, 2017 |
| Links: | GitHub · Packagist |
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.
Laravel Setup
Go to config/app.php and add the service provider to your 'providers' section:
CImrie\Odm\OdmServiceProvider::class
Publish the configuration file:
php artisan vendor:publish --tag=odm
You can now use the default Document Manager like so:
<?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.
To generate a Document Manager, you can do the following:
<?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' => [
]
]
]
));
Alternatives to cimrie/odm
Version History
| Version | Released | License |
|---|---|---|
| v0.2.10 | MIT | |
| v0.2.9 | MIT | |
| v0.2.8 | MIT | |
| v0.2.7 | MIT | |
| v0.2.6 | MIT | |
| v0.2.5 | MIT | |
| v0.2.4 | MIT | |
| v0.2.3 | MIT | |
| v0.2.2 | MIT | |
| v0.2.1 | MIT | |
| v0.2.0 | MIT | |
| v0.1.3 | MIT | |
| v0.1.2 | MIT | |
| v0.1.1 | MIT | |
| v0.1.0 | MIT |