Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Clarified & updated phar-cli-stub to match #64

wants to merge 13 commits into from

4 participants


The README has had an erroneous commit of mine for far too long and this PR should correct that.

FYI, I attempted a rebase and failed spectacularly, so let me know if this is too messy to merge...


Coding standards here.


Here as well.

This should actually use the PHAR method, but it seems to fail when a PHAR package is invalid (missing files, stub, etc.).


Looks good we just need some fixes for coding standards.

Do you have a reference for your coding standards? As a side note, this probably shouldn't be part of the commit, as the build process takes care of packaging. I just had several issues getting the unit tests to run via Phing/Ant.

For the time being, let's disregard this packager unless it's actually useful for individual devs.


It is basically the PEAR/Zend coding standards. The only problem I see is that you have extra spaces between the opening and closing parenthesis of your code.

Whoops, too much back-and-forth between SSJS & this :)

I'll rebase & make single pull-request with only the $input/$output support.


Wow, this PR turned to crap automatically via Github! Pulled in comments and everything!


@ericclemmons this is because your PR contains many old commits. You should use feature branches to send PRs, not your master branch, especially when the master branch contains commits that were rejected a year ago


Yea, this sucker's a mess =/

I'll cherry-pick the relevant commits into a super-sexy PR and resend! WOOOOOooooooOOO!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 23, 2010
  1. @ornicar
Commits on Oct 15, 2010
  1. Merge branch 'master' of into de…

    Eric Clemmons authored
Commits on Nov 1, 2010
  1. Updated doctrine-common & dbal

    Eric Clemmons authored
  2. stub references Symfony relative to phar root now

    Eric Clemmons authored
  3. Added DiffCommand

    Eric Clemmons authored
  4. Stub supports using an $input or $output variable, if set, when calli…

    Eric Clemmons authored
    …ng $cli->run()
  5. Added package script for building PHAR

    Eric Clemmons authored
Commits on Nov 2, 2010
  1. Added download link to README

    Eric Clemmons authored
Commits on Mar 9, 2011
  1. @ericclemmons
  2. @ericclemmons

    Removed my name from the README, linked to official documentation, an…

    ericclemmons authored
    …d added brief configuration examples
Commits on Mar 20, 2012
  1. @ericclemmons

    Merge branch 'master' of

    ericclemmons authored
This page is out of date. Refresh to see the latest.
Showing with 47 additions and 35 deletions.
  1. +45 −35 README.markdown
  2. +2 −0  phar-cli-stub.php
80 README.markdown
@@ -1,58 +1,68 @@
# Doctrine Database Migrations
-## Eric Clemmons' Modifications
+## Official Documentation
-The latest official PHAR had path issues for me, so I made a couple of modifications and made
-packaging a bit easier, especially when creating a custom PHAR for your own apps.
+**Read the latest documentation at the [Doctrine Migrations]( website**
-[Download `doctrine-migrations.phar` with custom Input/Output CLI support](
+## Features
-### Modifications
+* Single PHAR file for your projects
+* *Diff*ing pending migrations (if an Entity Manager is available)
+* Custom `ArgvInput` support in CLI
+* Custom `ConsoleOutput` support in CLI
-* Added `DiffCommand` for migrations.
-* Support for custom `ArgvInput` in CLI instance
-* Support for custom `ConsoleOutput` in CLI instance
-In the same way that Doctrine will attempt to load the return values from `migrations-db.php` as your
-connection parameters, you can have `migrations-input.php` return:
+## Building the PHAR
- $input = new \Symfony\Component\Console\Input\ArgvInput;
- ... make some changes ...
- return $input;
+ $ php package.php
-or have `migrations-output.php` return a customized `ConsoleOutput` with support for HTML tags in
-your SQL statements:
+(Creates `./build/doctrine-migrations.phar`)
- $output = new \Symfony\Component\Console\Output\ConsoleOutput;
- $output->setStyle('p');
- return $output;
+## [Configuration](
-This should give you the flexibility you need for customizing your input/output in the CLI.
+### migrations.yml
-### Building Your Phar
+Define how migrations will be stored and tracked within your database:
-Simply run `php package.php`, which will create the file: `build/doctrine-migrations.phar` for you.
-Done! :) This is a bit simpler than getting Phing/Ant going and running `phing build-migrations` and
-hoping the rest of the build dependencies work.
+ ---
+ name: Doctrine Sandbox Migrations
+ migrations_namespace: DoctrineMigrations
+ table_name: doctrine_migration_versions
+ migrations_directory: /path/to/migrations/classes/DoctrineMigrations
-### Creating archive disabled by INI setting
+### migrations-db.php
-If you receive an error that looks like:
+Define how to connect to your database:
- creating archive "build/doctrine-migrations.phar" disabled by INI setting
+ // migrations-db.php
-This can be fixed by setting the following in your php.ini:
+ ...
- ;
- phar.readonly = Off
+ return array(
+ 'driver' => 'pdo_mysql',
+ 'host' => 'localhost',
+ 'user' => 'migrations',
+ 'password' => 'm1gr@t10n$',
+ 'dbname' => 'doctrine_sandbox'
+ );
-### Installing Dependencies
+### migrations-input.php (Optional)
-To install dependencies issue the following commands:
+Specify defaults or provide your own custom `ArgvInput`, should you so desire:
- git submodule init
- git submodule update
+ $input = new \Symfony\Component\Console\Input\ArgvInput;
+ ... make some changes ...
+ return $input;
-## Official Documentation
+### migrations-output.php (Optional)
+If your database migrations contain HTML, you may run into issues with outputting the SQL to the console.
+This is because the `ConsoleOutput` class uses HTML-like tags for styling certain messages, such as `error`s,
+`info` messages, etc.
+For HTML to render properly, you can customize the `ConsoleOutput` within this file as follows:
-All available documentation can be found [here](
+ $output = new \Symfony\Component\Console\Output\ConsoleOutput;
+ $output->setStyle('p'); // Adds default styling to the 'p' tag, as to not throw a rendering exception
+ return $output;
2  phar-cli-stub.php
@@ -60,12 +60,14 @@
// Migrations Commands
+ new \Doctrine\DBAL\Migrations\Tools\Console\Command\DiffCommand(),
new \Doctrine\DBAL\Migrations\Tools\Console\Command\ExecuteCommand(),
new \Doctrine\DBAL\Migrations\Tools\Console\Command\GenerateCommand(),
new \Doctrine\DBAL\Migrations\Tools\Console\Command\MigrateCommand(),
new \Doctrine\DBAL\Migrations\Tools\Console\Command\StatusCommand(),
new \Doctrine\DBAL\Migrations\Tools\Console\Command\VersionCommand()
if ($helperSet->has('em')) {
$cli->add(new \Doctrine\DBAL\Migrations\Tools\Console\Command\DiffCommand());
Something went wrong with that request. Please try again.