silpo-tech/odm-bundle
Symfony bundle that integrates Doctrine ODM (MongoDB) document mapping into your app, with ready-made services, configuration and DI wiring so you can set up document-based persistence quickly and consistently.
Read this first: silpo-tech/odm-bundle is a Symfony bundle, not a Laravel package. There is no service provider, no facade, and no Eloquent-style API. A Laravel developer can still use the underlying ODM library, but the bundle's autoconfiguration and DI extensions are inert outside Symfony. Confirm what you're actually getting before installing:
composer show silpo-tech/odm-bundle --all
# Then read composer.json's "require" block and src/
The single most important thing to check is whether the bundle wraps Doctrine MongoDB ODM (doctrine/mongodb-odm) or a bespoke in-house ODM. That determines everything about how you'd use it day-to-day.
Minimal first steps (Symfony host):
composer require silpo-tech/odm-bundleconfig/bundles.php (SilpoTech\OdmBundle\... per the README).DependencyInjection/Configuration.php and Resources/config/ for the config tree and service IDs — this is where the actual knobs live.First use case: a small MongoDB-backed aggregate (e.g., an audit log or product catalog document) where you persist a plain PHP object through a DocumentManager and query it through a generated repository. If that path doesn't work end-to-end in under an hour, stop — the package is not mature enough to build on.
Reality check: 0 stars, 0 dependents, score 0.03, brand-new release. Treat this as an internal Silpo utility that leaked to Packagist, not a community package. Budget time for reading source.
In a Symfony app (intended use): rely on the bundle's DI wiring. Autowire the ODM's manager/repository services, annotate or attribute your Document classes, and let the bundle supply the client/config. Use it the way you'd use DoctrineBundle: configure connection in config/packages/*.yaml, then inject managers into services, commands, and message handlers. Keep documents as thin data holders and put behavior in services.
In a Laravel app (manual integration): you are reimplementing the bundle's DI extension by hand. The pattern is a small service provider that:
// app/Providers/OdmServiceProvider.php
public function register(): void
{
$this->app->singleton(DocumentManager::class, function ($app) {
$client = new Client($app['config']['database.mongodb.uri']);
return DocumentManager::create($client, $app['config']['odm'] ?? []);
});
}
Then bind repositories or resolve $dm->getRepository(MyDocument::class) per call. Skip the bundle entirely in this case — install the underlying ODM library directly and avoid a dependency you can't use.
Repository/service pattern: wrap the ODM in your own repository interfaces so controllers and jobs never touch the manager directly. This is the only way to keep ODM-specific types out of your domain and to make the code testable if you later swap the package out.
Queues and console: persist documents from jobs/commands by injecting the manager into the handler. Watch for connection lifecycle in long-running workers — recreate or ping the client between jobs.
Testing: point the manager at a disposable test database (or an in-memory Mongo-compatible substitute if supported) and clean collections between tests. Do not mock the DocumentManager; mock your own repository interfaces instead.
DependencyInjection/ and Resources/config/ code simply won't run. Decide early whether you're porting the config or dropping the bundle.composer why-not early if your app is on an older stack.Configuration.php. The YAML key names and defaults are not documented in the README. Read that file before writing config; guessing produces silent no-ops.bin/console debug:container --tag=doctrine_mongodb.odm.document_manager (or the bundle's own tag) and debug:config <bundle_alias> confirm what actually got registered. In Laravel, php artisan tinker plus app(DocumentManager::class) is your equivalent smoke test.tests/, and the source is a thin wrapper over Doctrine, use Doctrine MongoDB ODM directly. You lose nothing and gain a maintainable dependency.How can I help you explore Laravel packages today?