doctrine

doctrine/orm

PHP MIT Web Dev

Doctrine Object Relational Mapper (ORM)

10.2k stars
2.5k forks
active
GitHub

10.2k

Stars

2.5k

Forks

1.3k

Open issues

30

Contributors

3.6.7 25 May 2026

AI Analysis

Doctrine ORM is a mature object-relational mapper for PHP 8.1+ that provides transparent object persistence through a database abstraction layer and proprietary DQL query language. It is specifically designed for PHP developers building server-side applications that need to map relational databases to PHP objects, and is not suitable for non-PHP environments or applications without relational database requirements.

Web Dev Library Discovery value: 2/10
Documentation 8/10
Activity 9/10
Community 8/10
Code quality 8/10

Inferred from signals mentioned in the README (tests, CI, type safety) — not a review of the actual code.

Overall score 8/10

AI's overall editorial judgment — not an average of the bars above, can weigh other factors too.

orm php database-mapping dql persistence
Actively maintained Well documented MIT licensed Popular Production ready
Deep Analysis · Based on README and public signals
2w ago

Doctrine ORM: PHP's dominant object-relational mapper, still actively maintained after 15 years

Doctrine ORM maps PHP objects to relational database tables, providing transparent persistence, an identity map, lazy loading, and a proprietary query language (DQL) inspired by Hibernate's HQL. It is the de facto ORM for PHP's Symfony ecosystem and widely used in enterprise PHP applications. Multiple branches (2.x through 4.x) are simultaneously maintained, indicating a large, heterogeneous user base that cannot all migrate at once. It matters because the vast majority of PHP enterprise applications rely on it directly or through Symfony bundles.

Origin

Created in 2010, Doctrine ORM evolved from earlier PHP persistence experiments. It reached maturity with the 2.x series, became the default ORM in Symfony 2+, and has since undergone major cleanups in 3.x and 4.x to leverage modern PHP features.

Growth

Growth was driven primarily by Symfony's adoption of Doctrine as its recommended ORM. Stars grew steadily over the years but have plateaued — not because usage declined, but because the project is mature infrastructure that developers install without starring. Composer download numbers (not visible here) would tell a more accurate story than GitHub stars.

In production

Doctrine ORM is a foundational dependency of the Symfony framework, which powers a large share of professional PHP applications globally. Packagist download counts historically exceed hundreds of millions. It is used by major PHP-based platforms, SaaS products, and enterprise systems. Adoption is extensively documented through ecosystem integration (Symfony, API Platform, etc.) and community size.

Code analysis
Architecture

Likely follows a classical Data Mapper pattern with a UnitOfWork, IdentityMap, and EntityManager at the core. DQL is parsed into ASTs and translated to platform-specific SQL via DBAL. Appears to support multiple inheritance mapping strategies (single table, joined, class table). Multiple active branches (2.20, 2.21, 3.6, 3.7, 4.0) suggest careful semantic versioning and long-term support commitments.

Tests

CI badges for all five active branches are present and linked to Codecov, indicating automated coverage tracking. Actual percentage not documented in README, but the presence of per-branch Codecov badges on a project of this maturity strongly suggests substantial coverage.

Maintenance

Last push was 2026-06-16, roughly 10 days before the evaluation date — actively maintained. Five parallel branches receiving CI builds is an unusually strong maintenance signal. This is not a project in slow decline; it is actively backporting fixes and evolving the v4 line.

Honest verdict

ADOPT IF: you are building PHP applications with Symfony, need robust domain modeling using Data Mapper pattern, or require long-term maintainability with complex relational schemas. AVOID IF: you are building simple CRUD applications in Laravel (use Eloquent instead), need high-throughput write performance without ORM overhead, or are starting a project outside the PHP ecosystem entirely. MONITOR IF: you are on Doctrine 2.x and need to plan migration timelines to 3.x/4.x as older branches will eventually reach end of life.

Independent dimensions

Mainstream potential

5/10

Technical importance

8/10

Adoption evidence

9/10

Risks
  • The Data Mapper + UnitOfWork pattern introduces a steep learning curve; developers unfamiliar with the identity map and lazy-loading proxies frequently introduce N+1 query bugs or unexpected flush behavior.
  • Migrating between major versions (2.x to 3.x to 4.x) has historically required significant effort, and maintaining five active branches simultaneously signals that a large portion of users remain on older versions.
  • Doctrine's proxy-based lazy loading can cause issues with serialization, PHP 8.x readonly properties, and modern architecture patterns (e.g., readonly value objects in DDD), requiring workarounds.
  • Performance in write-heavy or bulk-operation scenarios can lag behind raw DBAL or query builders; the ORM abstraction adds overhead that may be unacceptable at high scale without careful tuning.
  • Dependency on the broader Doctrine ecosystem (DBAL, Annotations/Attributes, Cache) means updates to any component can introduce compatibility friction across large dependency trees.
Prediction

Doctrine ORM will remain the dominant PHP ORM in the Symfony ecosystem for the foreseeable future. Version 4.x will gradually consolidate users as PHP 8.1+ becomes standard, while niche alternatives like Cycle ORM may capture a portion of greenfield projects.

0 found this helpful

Newsletter

Get analyses like this every Monday

Free weekly digest of the most interesting open-source discoveries.

Languages

PHP
100%

Information

Language
PHP
License
MIT
Last updated
6h ago
Created
198mo ago
Analyzed with
anthropic/claude-haiku-4-5

Stars over time

Loading…

Contributors over time

Top 100 contributors only — repos with more will plateau at 100.

Loading…

Similar repos

doctrine

doctrine/persistence

Doctrine Persistence is a PHP library providing common abstractions for...

cycle

cycle/orm

Cycle ORM is a PHP DataMapper and ORM engine designed for both classic and...

1.3k PHP Web Dev
doctrine

doctrine/mongodb-odm

Doctrine MongoDB ODM is the official PHP object-document mapper for MongoDB,...

1.1k PHP Web Dev
doctrine

doctrine/dbal

Doctrine DBAL is a mature database abstraction layer for PHP that provides a...

9.7k PHP Dev Tools
doctrine

doctrine/data-fixtures

Doctrine Data Fixtures Extension provides a PHP library for managing and...

2.9k PHP Dev Tools
vs. alternatives
Eloquent (Laravel ORM)

Eloquent uses Active Record pattern, which is simpler to learn but mixes persistence concerns into domain objects. Doctrine's Data Mapper approach offers cleaner domain modeling and is preferred for complex domain logic. Eloquent dominates in the Laravel ecosystem; Doctrine dominates in Symfony.

TypeORM (TypeScript)

TypeORM targets Node.js/TypeScript and has more GitHub stars, reflecting the larger JS ecosystem rather than superior quality. Doctrine is more mature and battle-tested for complex relational mappings. Different language ecosystems; not direct competitors in practice.

Cycle ORM (PHP)

Cycle ORM is a modern PHP ORM with a cleaner architecture and better support for async runtimes (e.g., RoadRunner). It is a genuine alternative for greenfield PHP projects but has a fraction of Doctrine's ecosystem and community support.

RedBeanPHP

RedBeanPHP targets simplicity and rapid prototyping with automatic schema generation. It lacks Doctrine's depth for complex domain modeling, large-scale applications, or strict schema control. Appeals to different use cases.

Propel ORM (PHP)

Propel was a major Doctrine competitor in the 2.x era but has largely stagnated and lost community traction. It is no longer a practical alternative for new PHP projects.