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
Doctrine Bundle

Doctrine Bundle Laravel Package

doctrine/doctrine-bundle

Doctrine DBAL & ORM Bundle for Symfony, integrating the powerful Doctrine database abstraction layer and object relational mapper into Symfony applications with flexible configuration for entities, connections, and schema management.

View on GitHub
Deep Wiki
Context7

Symfony DoctrineBundle

Frequently asked questions about Doctrine Bundle
Can I use doctrine/doctrine-bundle in a Laravel application?
No. doctrine/doctrine-bundle is a Symfony bundle that registers Doctrine ORM and DBAL inside Symfony's dependency-injection container, exposes the doctrine configuration tree, and wires Symfony-specific compiler passes and console commands. None of that integration surface is portable to Laravel. For Laravel, use doctrine/orm and doctrine/dbal behind laravel-doctrine/orm or a thin custom service provider.
What is doctrine/doctrine-bundle used for?
It is the Symfony integration layer for Doctrine DBAL and ORM. It registers the EntityManager and connections in Symfony's container, exposes the doctrine configuration tree, configures mapping drivers, registers console commands, and provides the profiler panel. The underlying doctrine/orm and doctrine/dbal libraries are portable, but the bundle integration itself is Symfony-specific.
How do I install and configure DoctrineBundle in Symfony?
Install it with composer require doctrine/doctrine-bundle and enable the bundle in bundles.php if Symfony Flex does not do it for you. Configure doctrine.dbal and doctrine.orm in config/packages/doctrine.yaml, using the Symfony configuration reference as the source of truth. Pin the bundle branch to your Symfony major and clear the cache after configuration changes.
Which Doctrine ORM and DBAL versions are compatible with doctrine/doctrine-bundle?
Compatibility is tightly coupled: the bundle is versioned against Symfony 6, 7, and 8 as well as Doctrine ORM 2.x versus 3.x and DBAL 3 versus 4. The 2.18.x LTS-ish branch and the 3.x branch ship in parallel, so choose the pair that matches your Symfony and PHP version floor. Picking the wrong combination can produce subtle runtime failures, so check Composer constraints and release notes before upgrading.
What Laravel package replaces doctrine/doctrine-bundle?
There is no direct replacement because the bundle is Symfony-specific. In Laravel the idiomatic path is laravel-doctrine/orm or a purpose-built service provider that binds the EntityManager using doctrine/orm and doctrine/dbal directly. Budget explicitly for what the bundle would have provided: mapping-driver configuration, connection and middleware wiring, command registration, and request-scoped EntityManager reset.
Is DoctrineBundle compatible with Symfony 6, 7, and 8?
Yes, but you must pin the bundle branch to the Symfony major you operate. DoctrineBundle maintains parallel release lines, including a 2.18.x LTS-ish branch and a 3.x branch, and each line tracks specific Symfony and Doctrine versions. Review the release notes and deprecations before upgrading across Symfony majors.
What are the deprecations in doctrine/doctrine-bundle configuration?
Active deprecations include controller_resolver.auto_mapping, enable_lazy_ghost_objects, and enable_native_lazy_objects. These are options teams often inherit from older copied configs, so expect noisy deprecation logs until you migrate them. Check the bundle upgrade notes for the exact replacements and remove obsolete settings.
Do I need second-level cache with DoctrineBundle and what does it require?
Second-level cache is optional and only needed if your read patterns justify it. Enabling it adds Redis or APCu as a hard runtime dependency and creates a cache-invalidation ownership burden. Configure it under doctrine.orm.second_level_cache and plan monitoring and invalidation rules before using it in production.
Is doctrine/doctrine-bundle safe for production and who maintains it?
It is a high-blast-radius persistence dependency because it owns credentials, migrations, and query generation. Symfony's advisory process covers security issues, but that makes a regular upgrade cadence non-optional. Upstream is a small volunteer maintainer group, so name an internal owner for the dependency and do not rely on dependents counts or last-release dates in decision documents.
How do I test a Laravel app that uses Doctrine ORM instead of Eloquent?
Do not install DoctrineBundle for this. Use doctrine/orm and doctrine/dbal through laravel-doctrine/orm or a custom provider, then test the EntityManager against a dedicated test database. Reset the EntityManager between requests and tests, and wrap test cases in transactions or use the schema tool to keep fixtures isolated.
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.
vento/laravel-airbrake
wfeller/laravel-batch
maco-studios/mage-os-installer
busarm/armie
siberfx/laravel-logger
kfteam1991/dcat-admin
dashed/dashed-laposta
dashed/dashed-ecommerce-montaportal
dashed/dashed-ecommerce-etsy
neohq/string-blade-compiler
log1x/acf-composer
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core
nodisrupt/laravel-agent
sierratecnologia/media-manager