Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
94 lines (60 sloc) 2.43 KB

Installation

Doctrine can be installed many different ways. We will describe all the different ways and you can choose which one suits you best.

Composer

Composer is the suggested installation method for Doctrine. Define the following requirement in your composer.json file:

{
    "require": {
        "doctrine/orm": "*"
    }
}

Then run the composer command and you are done. Continue with the :doc:`Configuration <configuration>`.

PEAR

You can easily install any of the three Doctrine packages from the PEAR command line installation utility.

To install just the Common package you can run the following command:

$ sudo pear install pear.doctrine-project.org/DoctrineCommon-<version>

If you want to use the Doctrine Database Abstraction Layer you can install it with the following command.

$ sudo pear install pear.doctrine-project.org/DoctrineDBAL-<version>

Or, if you want to get the works and go for the ORM you can install it with the following command.

$ sudo pear install pear.doctrine-project.org/DoctrineORM-<version>

Note

The <version> tag above represents the version you want to install. For example if the current version at the time of writing this is 2.2.2 for the ORM, so you could install it like the following:

$ sudo pear install pear.doctrine-project.org/DoctrineORM-2.2.2

GitHub

Alternatively you can clone the latest version of Doctrine 2 via GitHub.com:

$ git clone git://github.com/doctrine/doctrine2.git doctrine

This downloads all the sources of the ORM package. You need to initialize the Github submodules for the Common and DBAL package dependencies:

$ git submodule init
$ git submodule update

This updates your Git checkout to use the Doctrine and Doctrine package versions that are recommended for the cloned Master version of Doctrine 2.

See the configuration chapter on how to configure a Github installation of Doctrine with regards to autoloading.

Note

You should not combine the Doctrine-Common, Doctrine-DBAL and Doctrine-ORM master commits with each other in combination. The ORM may not work with the current Common or DBAL master versions. Instead the ORM ships with the Git Submodules that are required.