The Doctrine Project consists of several libraries (components). Each Doctrine component is distributed as a Composer-installable package and registered in Packagist.org catalogue. This is very similar to the way that Zend Framework 3 uses for installing its components.
Here we will provide you with a brief description of Doctrine library architecture to let you a general idea of its capabilities.
Main Doctrine components designed for working with relational databases are shown in figure D.2 and marked with green. Blue blocks denote the PHP engine and PHP extensions Doctrine is built on top of.
As you can see from the figure, Doctrine is based on PHP engine features and on PHP extensions
that are actually used as drivers to particular database management systems. Above that base layer, there
are core Doctrine components (like Annotations
, Common
, etc.) providing essential functionality
for other top-level components. The DBAL
component provides an abstraction layer of database type.
And on top of all that there is the ORM
component providing API for working with data in object-oriented
way. DoctrineModule
and DoctrineORMModule
components are designed for integration with Zend Framework 3.
Doctrine ORM component uses the so called Data Mapper pattern. This pattern tells that a database table can be represented as a PHP entity class. The database in this pattern is considered as some kind of repository (storage of entities). When you retrieve an entity from the repository, an SQL query is performed internally, and an instance of the PHP entity class is constructed and its properties are filled with data.
By analogy with ZF3 components, Doctrine component names consist of two parts: the vendor name ("Doctrine") and the component name (e.g. "Common"). Below, you can find the list of Doctrine components together with their Composer-installable package names and brief descriptions:
Doctrine\Common
. Common Library for Doctrine projects. This component contains commonly used
functionality. Its Composer-installable package name is doctrine/common
.
Doctrine\Annotations
. Docblock Annotations Parser. Its Composer-installable package name is
doctrine/annotations
.
Doctrine\Inflector
. Common String Manipulations with regard to casing and singular/plural rules.
Its Composer-installable package name is doctrine/inflector
.
Doctrine\Lexer
. Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.
Its Composer-installable package name is doctrine/lexer
.
Doctrine\Cache
. Caching library offering an object-oriented API for many cache backends.
Its Composer-installable package name is doctrine/cache
.
Doctrine\DBAL
. Database Abstraction Layer. This is a lightweight and thin runtime layer around
a PDO-like API and a lot of additional, horizontal features like database schema introspection and
manipulation through an object oriented API. Its Composer-installable package name is doctrine/dbal
.
Doctrine\Collections
. Collections Abstraction library. Its Composer-installable package name is
doctrine/collections
.
Doctrine\ORM
. Object-Relational-Mapper for PHP. This is a Doctrine component providing a way to
work with entity models in object-oriented way instead of raw SQL queries. Its composer installable
package name is doctrine/orm
.
Doctrine\Migrations
. Database Schema migrations using Doctrine DBAL. Provides a consistent way
to manage database schema and update it. Its composer installable package name is doctrine/migrations
.
Doctrine\DataFixtures
. Data Fixtures for all Doctrine Object Managers.
Provides a framework for making database fixtures. Its composer installable package name is
doctrine/data-fixtures
.
Since Doctrine uses PHP autoloading and PSR-4 standard, classes belonging to certain component live
in that component's namespace. For example, the EntityManager
class belonging to Doctrine\ORM
component, lives in Doctrine\ORM
namespace.
Doctrine components designed for working with NoSQL document databases (MongoDB, CouchDB, etc.) are shown in figure D.3 and marked with green. Blue blocks denote the PHP engine and PHP extensions Doctrine is built on top of.
As you can see from the figure D.3, Doctrine NoSQL components are based on PHP engine features
and on PHP extensions that can be considered as "drivers" to particular database management systems.
Above that base layer, there are middle level components. The Common
component is the same component that was shown in figure
D.2; it provides commonly used functionality. The MongoDB
and CouchDB
are components providing
low-level API to corresponding databases. The MongodbODM
, CouchdbODM
, OrientdbODM
and PhpcrODM
components provide Object Document Mappers (ODM) for corresponding databases. ODM concept is very
similar to ORM in sense that it provides an ability to work with a NoSQL database in object oriented
way by mapping a document to a PHP entity class. The DoctrineMongoODMModule
component is intended
for integration with ZF3.
Below, you can find the list of components together with their Composer-installable package names and brief descriptions:
Doctrine\MongoDB
is Doctrine MongoDB Abstraction Layer. Its Composer-installable package name is
doctrine/mongodb
.
Doctrine\MongodbODM
(Object Document Mapper) provides a way to map NoSQL documents to PHP
entity models. Its Composer-installable package name is doctrine/mongodb-odm
.
Doctrine\MongoODMModule
is Zend Framework 3 Module that provides Doctrine MongoDB ODM
functionality. It serves for easy integration with ZF3. Its Composer-installable package name is
doctrine/doctrine-mongo-odm-module
.
Doctrine\CouchDB
component provides Simple API that wraps around CouchDBs HTTP API. Its Composer-installable
package name is doctrine/couchdb
.
Doctrine\CouchdbODM
component is CouchDB Document Object Mapper. It is analogous to Doctrine ORM in sence
that it provides the way to access database in object oriented way. Its Composer-installable
package name is doctrine/couchdb-odm
.
Doctrine\OrientdbODM
is a set of PHP libraries in order to use OrientDB from PHP. Its Composer-installable
package name is doctrine/orientdb-odm
.
Doctrine\PhpcrODM
is Object-Document-Mapper for PHPCR. Its Composer-installable
package name is doctrine/phpcr-odm
.