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

Orm Laravel Package

doctrine/orm

Doctrine ORM is an object-relational mapper for PHP 8.1+ that provides transparent persistence for PHP objects on top of the DBAL, with DQL, an object-oriented SQL dialect inspired by Hibernate's HQL.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit. Doctrine ORM is a data-mapper ORM built on Doctrine DBAL, and it is architecturally orthogonal to Laravel's default persistence layer. Laravel ships Eloquent, an active-record implementation where models are both query surface and row state. Doctrine inverts this: entities are plain PHP objects, persistence is mediated by an EntityManager implementing a Unit of Work and Identity Map, and queries are expressed in DQL (a Hibernate-inspired object query dialect) rather than Eloquent's builder or raw SQL. This is a genuine paradigm shift, not a drop-in replacement — it changes how developers think about saving, retrieving, and transactionally grouping objects. The payoff is real: clean domain models free of framework coupling, explicit aggregate persistence, embeddables, mapped inheritance (single-table, joined, class-table), and a well-specified lifecycle event system. That fits a Laravel codebase organized around hexagonal or DDD-style bounded contexts. It fits poorly in a conventional Laravel CRUD app where Eloquent's ergonomics are the productivity engine.

Integration feasibility. doctrine/orm is framework-agnostic; it has no Laravel service provider. Bridging it requires the community package laravel-doctrine/orm (plus laravel-doctrine/migrations if you want Doctrine's schema tooling), which supplies configuration, an EntityManager binding, and Artisan commands. That bridge is the critical path, and its release cadence lags Doctrine core — ORM 4.0 is on the branch matrix while the Laravel bridge is unlikely to support it yet. The reported Dependents: 0 reinforces that no downstream Laravel consumer was detected in the scan, so compatibility must be proven by us, not assumed. Minimum PHP is 8.1, which is satisfied by current Laravel 10/11/12 baselines, so the language requirement is not the constraint; the constraint is bridge maturity against the specific ORM major we pin.

Technical risk.

  • Dual persistence stacks. Doctrine DBAL and Laravel's Illuminate\Database will coexist unless we deliberately consolidate. Two connection pools, two transaction coordinators, and the risk of DB::transaction() nesting around an EntityManager::flush() that holds its own transaction. This is the highest-severity architectural hazard and needs an explicit rule: all writes in Doctrine-managed contexts go through the EntityManager.
  • Migrations bifurcation. Doctrine Migrations and Laravel Migrations both want to own schema history. Running both is a schema-drift generator. We must pick one owner per schema, and Doctrine's schema tool is also opinionated enough to want to "correct" tables it doesn't understand (e.g., Laravel's jobs, cache, sessions).
  • Serialization impedance. Entities carry proxies and lazy collections. Handing them to JsonResource or toArray() invites circular references, N+1 storms, and accidental lazy loads post-serialization. A DTO / API-resource mapping layer is mandatory scope, not polish.
  • Release-date anomaly. The listed last release of 2026-10-09 is in the future relative to any sane reading and should be treated as a metadata defect; do not let it drive a version decision.
  • Documentation license. Code is MIT, but the docs tree is CC BY-NC-SA 3.0 — non-commercial. Copying documentation into commercial internal wikis or training material is a compliance question worth a five-minute legal check.

Key questions.

  1. Which ORM major do we pin, and does the chosen Laravel bridge officially support it at that version?
  2. Are we migrating a greenfield bounded context, or retrofitting existing Eloquent models? The answer changes risk by an order of magnitude.
  3. Who owns schema — Doctrine Migrations or Laravel Migrations — and how do we segregate framework-owned tables?
  4. Will this run under Octane or long-lived queue workers? If yes, the Identity Map lifecycle becomes a first-class design concern.
  5. Do we need second-level caching, and are we prepared to own that infrastructure?

Integration Approach

Stack fit. Best fit is a Laravel monolith or modular monolith where one or more bounded contexts are deliberately carved out with rich domain logic, complex aggregate graphs, and non-trivial inheritance. Worst fit is a short-lived CRUD product or an existing Eloquent-heavy app with dozens of interconnected models. The integration introduces a second ORM, so the value proposition must be concentrated enough that the coexistence cost is worth it.

Migration path. Use a strangler pattern at the context boundary, not a big-bang rewrite:

  1. Spike (1–2 weeks). Stand up laravel-doctrine/orm with the pinned ORM version in a throwaway branch. Prove: container binding, config, one entity, one repository, one DQL query, one transactional write, one test with an in-memory SQLite schema. Success criteria are binary — if the bridge fights the Laravel version, stop here and re-evaluate.
  2. Pilot context. Choose a single bounded context with real domain complexity but low blast radius (not authentication, not billing). Model it fully in entities; keep the read path on Eloquent or query builder if that's cheaper.
  3. Coexistence contract. Publish written rules: which namespaces are Doctrine-owned, which are Eloquent-owned, transaction boundaries, and a hard prohibition on cross-ORM writes inside a single unit of work.
  4. Expand or retreat. Only extend to a second context after the first has run a full release cycle in production.

Compatibility. Version-pin the ORM, the bridge, and DBAL together, and treat them as a single upgrade unit. The bridge is the fragile dependency; if it stalls, we inherit an ORM we can't upgrade and a security-patch exposure we can't close. Budget for the possibility of vendoring or forking the service provider — it's a thin package and that's a tractable, if unglamorous, contingency.

Sequencing. Configuration and container wiring → entity mapping conventions and base classes → repository abstraction → transaction policy → DTO/serialization layer → migration ownership decision → observability hooks. Serialization and transaction policy must land before the pilot reaches production; teams routinely defer both and pay for it in incident form.

Operational Impact

Maintenance. Two ORMs means two upgrade calendars and two bodies of framework-specific knowledge. Doctrine's majors are breaking-heavy: annotations to attributes, EntityManager API changes, DBAL 3→4 shifts. Each upgrade touches every entity and repository. The bridge's lag becomes our lag. Conversely, Doctrine's release discipline and long-term support branches (evidenced by the parallel 2.20 through 4.0 matrix) are better than most PHP packages — this is a mature, well-governed project, and that predictability is a genuine operational asset.

Support. Community-supported, no vendor SLA. The talent pool is the real operational constraint: Doctrine expertise is common in Symfony shops and rare in Laravel shops. Expect a 2–4 week productive ramp for a strong Laravel developer, with the steepest curve being the Unit of Work ("why didn't my change persist?"), DQL, and lifecycle callbacks. Plan for one internal Doctrine champion rather than diffuse ownership; diffuse ownership of two persistence layers degrades into neither being well understood.

Scaling. Read scaling is fine — DQL compiles to SQL and the DBAL layer is thin. The scaling hazards are application-level:

  • Memory. The Identity Map holds every managed entity for the EntityManager's lifetime. Under Octane or long-running queue workers this is a leak unless we clear or reset the manager per request/job. This must be a documented, tested invariant, not folklore.
  • Query shape. Lazy loading is opt-in-by-default behavior and produces N+1s that Eloquent developers won't instinctively look for. Enforce fetch-join discipline in code review and consider a query-count assertion in the test suite.
  • Caching. Second-level cache is available but opt-in; treating it as free performance is a common and costly assumption.

Failure modes. Watch for: silent non-persistence from missing flush(); partial writes when flush() throws mid-unit-of-work and the transaction boundary was set by Laravel rather than Doctrine; stale entities from a long-lived Identity Map returning outdated data after out-of-band updates; lazy-load exceptions on detached entities after serialization; and schema drift where Doctrine's schema tool and Laravel migrations disagree. Each maps to a specific guardrail — per-job manager reset, Doctrine-owned transaction boundaries, DTO mapping, and single-owner migrations — and each guardrail should be treated as a mandatory deliverable rather than an aspiration.

Overall. A strong, mature, MIT-licensed package that solves real problems for the right codebase shape. The score reflects the package's quality; the opportunity score reflects that it is a deliberate architectural choice, not an easy win. Recommend a bounded pilot with a pre-committed exit criterion, gated on the Laravel bridge proving compatible with our pinned ORM version.

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