Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Mongodb Bundle

Mongodb Bundle Laravel Package

facile-it/mongodb-bundle

Symfony bundle that integrates Doctrine MongoDB ODM into your app, wiring document managers, repositories, and mappings through simple configuration so you can persist and query MongoDB documents using Symfony's service container.

View on GitHub
Deep Wiki
Context7

facile-it/mongodb-bundle provides seamless MongoDB integration for Symfony applications, wrapping Doctrine MongoDB ODM with sensible defaults and flexible configuration. It registers clients, document managers, and repositories as Symfony services, so you can work with MongoDB documents using familiar Symfony/Doctrine patterns.

  • Automatic configuration of MongoDB clients and DocumentManager services
  • Integration with Doctrine MongoDB ODM mappings and repositories
  • Symfony profiler and logging support for debugging queries
  • Flexible configuration for multiple connections and databases
  • Compatible with modern Symfony service container conventions
Frequently asked questions about Mongodb Bundle
How do I install facile-it/mongodb-bundle in a Symfony application?
Require the package with Composer, enable the bundle in config/bundles.php, and provide a connection DSN in the bundle configuration. You also need the ext-mongodb PHP extension installed at the host or container image level, because it is a C extension and cannot be shipped via Composer. Once configured, MongoDB\Client, MongoDB\Database and MongoDB\Collection become available for autowiring.
Does facile-it/mongodb-bundle work with Laravel?
No. It is a Symfony bundle that plugs into the Symfony DI container and bundle system, so it has no Laravel service provider or Laravel-specific config. Laravel teams should use mongodb/laravel-mongodb or the official library directly. This package is only a candidate for Symfony applications.
How is facile-it/mongodb-bundle different from Doctrine MongoDB ODM?
This bundle is a thin service-integration layer: it wires the official mongodb/mongo-php-library into the container and exposes the driver's native API. It provides no document mapping, repositories, hydrators or lifecycle events. If you need entities, embedding strategies and ODM-style callbacks, evaluate doctrine/mongodb-odm-bundle instead.
Which Symfony, PHP and ext-mongodb versions are supported?
The provided evaluation does not pin an exact version matrix, so check the package's composer.json and CI configuration before committing. The intended baseline is Symfony 5.4/6.x/7.x on PHP 8.1+, but each Symfony major and ext-mongodb release must be confirmed against the current tag. Treat version alignment as an upgrade risk, since the bundle sits between Symfony, the PHP library and the C extension.
Can I configure multiple MongoDB connections or clients?
The evaluation lists multiple named connections, per-connection authentication and replica-set or SRV strings as key open questions rather than confirmed features. Verify the bundle's config schema against the topology you actually need before designing around it. If multi-connection support is missing, you can still define additional MongoDB\Client services manually in services.yaml.
How do I inject MongoDB\Collection into a Symfony service?
Type-hint MongoDB\Collection in a constructor or controller argument and let autowiring resolve it, or resolve it from MongoDB\Database or MongoDB\Client inside a small factory. Making those driver classes autowirable is the bundle's main job, so custom service definitions are usually unnecessary. Because type-based autowiring cannot distinguish two collections, document which collection each service receives.
Does it support replica sets, SRV connection strings and authentication?
The underlying official PHP library supports replica sets, mongodb+srv:// strings and SCRAM authentication, and the bundle passes your DSN through to it. What is not guaranteed from the provided documentation is whether every driver option is exposed in the bundle's own config schema. Validate against a staging replica set before relying on it in production.
How does the bundle handle connections in RoadRunner, Swoole or Messenger workers?
The evaluation flags client lifecycle, lazy connection and reuse under long-running workers as unresolved questions. The official driver connects lazily and is generally safe to reuse across requests in a worker, but you must avoid leaking state between jobs and confirm the bundle does not rebuild clients per request in a way that breaks that. Test under your actual worker runtime rather than assuming.
Is there a Symfony profiler data collector or tracing integration?
Observability appears to be left to the consuming application; no profiler data collector is documented for this bundle. Plan to add logging, metrics or OpenTelemetry instrumentation around the driver's command monitoring. As a thin wrapper, you inherit the official library's monitoring hooks rather than bundle-specific ones.
Is facile-it/mongodb-bundle safe to use in production?
It is maintained by Facile.it, a commercial company with a track record of Symfony open-source work, and it wraps the official, mature mongodb/mongo-php-library, so the driver's security posture carries through largely unchanged. The caution is adoption: roughly 38 stars and no dependents mean a shallow public knowledge base and limited third-party scrutiny. Pin versions, review the changelog on each upgrade, and be ready to maintain a fork if release cadence stalls.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo
bernskioldmedia/laravel-harvest
bernskiold/laravel-data-scrubber
bernskiold/laravel-currency-converter
bernskiold/laravel-campaign-monitor
bernskioldmedia/laravel-autotranslate
siberfx/telegram-bot
roy-sandip/laravel-view-extended
gregsphotography/site-builder-core
roy-sandip/laravel-view
anodyne/blade-fluentui-icons
webx-ui/module-catalog-collections