Weave Code
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

Symfony bundle integrating Doctrine DBAL and ORM. Provides database abstraction, schema tools, and an object-relational mapper with DQL for powerful queries, plus configuration and tooling that fits the Symfony ecosystem.

View on GitHub
Deep Wiki
Context7

Symfony DoctrineBundle

Frequently asked questions about Doctrine Bundle
Can I use DoctrineBundle directly in Laravel, or should I avoid it?
Avoid using DoctrineBundle in Laravel. It’s designed for Symfony’s bundle architecture and dependency injection system, which doesn’t align with Laravel’s service container. Instead, use standalone packages like `doctrine/dbal` and `doctrine/orm` for full Laravel compatibility.
How do I integrate Doctrine ORM/DBAL into Laravel without Symfony’s bundle?
Install `doctrine/dbal` and `doctrine/orm` via Composer, then configure them in Laravel’s `config/app.php` and service provider. Doctrine’s core libraries work seamlessly with Laravel’s Eloquent or as a standalone ORM. Follow the [Doctrine Laravel documentation](https://www.doctrine-project.org/projects/orm.html) for setup.
What are the key differences between Doctrine ORM and Laravel’s Eloquent?
Doctrine ORM offers advanced features like DQL (Doctrine Query Language), inheritance mapping, and complex schema tools, while Eloquent prioritizes simplicity and Laravel integration. Doctrine is better for legacy databases or high-complexity queries, but Eloquent is often sufficient for most Laravel apps.
Will Doctrine ORM work with Laravel’s migrations system?
Doctrine ORM itself doesn’t integrate with Laravel Migrations, but you can use `doctrine/doctrine-migrations-bundle` (Laravel-compatible) for database migrations alongside Eloquent or Doctrine entities. This bundle provides a CLI tool (`doctrine migrations`) for managing schema changes.
Does DoctrineBundle support Laravel’s latest versions (e.g., Laravel 10/11)?
DoctrineBundle is Symfony-specific and not designed for Laravel, but the underlying Doctrine ORM/DBAL libraries (e.g., `doctrine/orm:^3.0`) support Laravel 10/11. Always check the [Doctrine ORM compatibility table](https://www.doctrine-project.org/projects/orm.html) for version alignment.
How do I configure Doctrine ORM in Laravel’s service container?
Register Doctrine’s services in a Laravel service provider by binding the `EntityManager` and `Connection` interfaces. Use Laravel’s configuration files (e.g., `.env` for DB credentials) and autoload Doctrine’s entities via `doctrine/orm`'s annotation or XML/YAML mapping tools.
Can I mix Doctrine ORM and Eloquent in the same Laravel project?
Yes, but it requires careful configuration. Use separate database connections or namespaces for entities to avoid conflicts. Doctrine ORM and Eloquent can coexist, but shared models or queries may need manual handling to prevent dependency issues.
What performance trade-offs exist between Doctrine ORM and Eloquent in Laravel?
Doctrine ORM may introduce slight overhead due to its feature-rich architecture (e.g., DQL parsing, hydration strategies). Benchmark critical queries in your Laravel app, as Eloquent is optimized for simplicity and speed in most use cases. Use tools like Blackfire to compare.
Are there Laravel-specific Doctrine extensions or tools I should know about?
Yes, packages like `laravel-doctrine/orm` provide Laravel-specific integrations (e.g., Artisan commands for Doctrine). Additionally, extensions like `stof/doctrine-extensions` (e.g., for sluggable fields) work with Doctrine ORM in Laravel. Check Packagist for Laravel-compatible Doctrine tools.
How do I handle Doctrine’s DQL queries in Laravel templates or Blade?
DQL queries are executed in PHP logic (e.g., controllers or services) and return results as arrays or objects. Pass these results to Blade views for rendering. Avoid embedding raw DQL in Blade—use Laravel’s query builder or Eloquent for view-layer queries when possible.
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.
calmfox/watch-sylius
damienfern/grpc-symfony-bundle
atoolo/index-bundle
atoolo/genai-bundle
coprotoai/laravel-ticket
davidjln/llm-carbon-bundle
cryonighter/valid-request-bundle
coolms/taxonomy-bundle
coolms/field-bundle
articulate-orm/symfony
aaix/laravel-tall-architect
ephoto/akeneo-connector
emmanuelballery/eb-plantumlbundle
emielburgman/symfony-visitor-beacon
emielburgman/symfony-visit-storage
emielburgman/symfony-security-headers
emielburgman/symfony-log-viewer
emarref/xdebug-bundle
emarref/pubnub-bundle
elriseio/finance-money-bundle