brouwers/laravel-doctrine
Integrates Doctrine ORM into Laravel, swapping Eloquent for a data-mapper approach. Provides entity and metadata management, container bindings, repositories, and migration support so you can use Doctrine's mapping, DQL, and Unit of Work inside a familiar Laravel application.
This package sits in a well-known architectural gap: Laravel ships with Eloquent/ActiveRecord, while Doctrine offers a Data Mapper + Unit of Work model with a richer metadata, DQL, and migration story. brouwers/laravel-doctrine is an integration bridge that wires Doctrine's EntityManager into Laravel's service container, config system, and lifecycle (config publishing, facades/aliases, console command registration, and repository wiring). The value proposition is legitimate — teams that prefer Doctrine's mapping, second-level cache, or explicit hydration model can use it without hand-rolling bootstrap glue in every Laravel project.
Architecture fit. The package's design is reasonably idiomatic for a Laravel bridge: a service provider that binds the EntityManager, merges configuration, and exposes Doctrine commands through Artisan. However, it is tightly coupled to the Laravel 5 era — its service provider, config publishing, and package discovery conventions predate Laravel 6/7 changes and certainly Laravel 9/10/11. It assumes a Doctrine ORM generation (2.x era) that has since moved on (Doctrine 2.8+, ORM 2.10+ deprecations, PHP 8 attribute-based mapping). It is a bridge, not a framework — so it does not solve for transactional boundaries across Eloquent and Doctrine, nor for shared connection/pool management across both ORMs.
Integration feasibility. Non-trivial. For Laravel 5.x–5.8 it is plausibly a drop-in with the usual config publish + provider registration. For Laravel 6+ you will fight composer.json constraint conflicts (PHP and illuminate/support). For Laravel 9+ you will almost certainly be forking or vendoring. There is no namespace or binding that maps cleanly onto Laravel 10/11's container changes without a patch. The 2019 last release and archived status mean no compatibility fixes have been — or will be — applied.
Technical risk. High. This is a low-adoption, archived package (24 stars, 0 dependents, archived). The realistic failure modes are:
laravel/framework and doctrine/orm.Key questions to answer before committing:
doctrine/laravel-doctrine-style bridges, or the more active community forks) acceptable, or is the team committed to owning this code?Stack fit. Reasonable only if the team has already chosen Doctrine ORM deliberately and can restrict to a compatible Laravel version (Laravel 5.5–5.8 is the honest fit; anything later is a compatibility project). If the org is on Laravel 10/11 — which most are — this package is a starting reference, not an installable dependency.
Migration path. Do not adopt this as a long-lived external dependency. Instead:
Internal\DoctrineBridge), tag internally, and pin. Budget for it as internal code, not a package.illuminate/* and doctrine/orm, replacing deprecated annotation config with attribute-based mapping and updating the service provider to modern Laravel service provider conventions.EntityManager, generate proxies, run Doctrine migrations, register commands, and confirm container injection into a controller and a queued job.Compatibility. Verify the matrix: PHP 8.1+/8.2, doctrine/orm 2.14+, doctrine/migrations 3.x, Laravel 10/11 illuminate/support. Expect the config publishing and command registration to need rewrites; expect the facades/aliases to still work but to be re-verified.
Sequencing.
Maintenance. The upstream is archived and has 0 dependents; there is no realistic community maintenance. Once forked, your team owns every line. Budget a recurring line item — this is a small codebase but it sits at a version-sensitive seam (Laravel ↔ Doctrine), so expect meaningful upgrade churn on every Laravel major, and on Doctrine ORM minor bumps.
Support. No upstream support, no security releases, no issue triage. Internal ownership requires an on-call owner, a runbook, and an internal fork-with-rationale decision record. This is a governance item, not just a technical one.
Scaling. The bridge is thin — it does not meaningfully constrain application scaling, but Doctrine's identity map and unit-of-work introduce long-lived EntityManager hygiene requirements (clear/detach in long-running workers, queue workers, Octane). Mixed Eloquent + Doctrine transactions on the same DB connection need explicit design. The second-level cache, if used, needs a cache backend and invalidation discipline.
Failure modes.
composer update breaks the lock — resolved by internal pinning.doctrine/orm and the bridge → runtime binding errors on boot.Ramp-up. Steep for engineers who only know Eloquent. Doctrine's Data Mapper, repository pattern, DQL, and mapping lifecycle are a genuine mental model shift. Assume 2–4 weeks of ramp for a mid-level engineer on a real feature before productivity, plus deliberate pairing to codify conventions (repository boundaries, entity purity, migration discipline). The bridge itself is easy to read; the Doctrine model is the learning curve.
Recommendation. Do not adopt brouwers/laravel-doctrine as a dependency. If Doctrine is a firm architectural requirement, adopt it as an internal vendored fork with an owned CI matrix, a named maintainer, and an explicit upgrade budget — and only for Laravel 5.5–5.8 if the org is still on it; on Laravel 9+ this is a rebuild, not an integration. If Doctrine is not a firm requirement, stay on Eloquent and spend the saved maintenance on the actual product.
How can I help you explore Laravel packages today?