The Doctrine Project is the home to several PHP libraries primarily focused on database storage and object mapping. The core projects are the Object Relational Mapper (ORM) and the Database Abstraction Layer (DBAL) it is built upon.

One of Doctrine’s key features is the option to write database queries in Doctrine Query Language (DQL), an object-oriented dialect of SQL.

The benefit of Doctrine for the programmer is the ability to focus on the object-oriented business logic and worry about persistence only as a secondary problem. This doesn’t mean persistence is downplayed by Doctrine 2, however it is our belief that there are considerable benefits for object-oriented programming if persistence and entities are kept separated.

Doctrine’s public interface is through the EntityManager. This class provides access points to the complete lifecycle management for your entities, and transforms entities from and back to persistence.

The EntityManager#getRepository() method can create a finder object (called a repository) for every type of entity. It is provided by Doctrine and contains some finder methods like findAll().

With Doctrine have to work with the foreign keys directly. You should only work with objects that represent foreign keys through their own identities. For every foreign key you either have a Doctrine ManyToOne or OneToOne association. On the inverse sides of these foreign keys you can have OneToMany associations

Metadata for an Entity can be configured using DocBlock annotations directly in the Entity class itself, or in an external XML or YAML file.

Doctrine has large community and integrations with many different frameworks Symfony, Laravel, Zend Framework and more.