The Doctrine Migrations project offers additional functionality on top of the DBAL and ORM for versioning your database schema. It makes it easy and safe to deploy changes to it in a way that can be reviewed and tested before being deploying to production.


You can use the Doctrine Migrations project by installing it with Composer or by downloading the latest PHAR from the releases page on GitHub.

For this documentation exercise we will assume you are starting a new project so create a new folder to work in:

$ mkdir /data/doctrine/migrations-docs-example
$ cd /data/doctrine/migrations-docs-example


Now to install with Composer it is as simple as running the following command in your project.

$ composer require doctrine/migrations:2.0.x-dev

Now you will have a file in vendor/bin available to run the migrations console application:

$ ./vendor/bin/doctrine-migrations


To install by downloading the PHAR, you just need to download the latest PHAR file from the releases page on GitHub.

Here is an example using the 1.7.2 release:

$ wget https://github.com/doctrine/migrations/releases/download/v1.7.2/doctrine-migrations.phar

Now you can execute the PHAR like this:

$ php doctrine-migrations.phar

Next Chapter: Configuration