2017 © Pedro Peláez
 

library silex-doctrine-migrations-provider

A doctrine migrations provider for silex

image

kurl/silex-doctrine-migrations-provider

A doctrine migrations provider for silex

  • Wednesday, June 13, 2018
  • by breenie
  • Repository
  • 3 Watchers
  • 21 Stars
  • 38,639 Installations
  • PHP
  • 1 Dependents
  • 1 Suggesters
  • 12 Forks
  • 3 Open issues
  • 15 Versions
  • 21 % Grown

The README.md

silex-doctrine-migrations-provider

A doctrine migrations service provider for Silex 2.x or Pimple 3.x., (*1)

Installation

Install the provider through Composer:, (*2)

composer require kurl/silex-doctrine-migrations-provider

Usage

Parameters

These are the configuration parameters you could configure for the provider:, (*3)

  • migrations.directory: The directory with migrations. Required.
  • migrations.namespace: The namespace for the migration classes. Required.
  • migrations.name: The name of the migrations suite. Defaults to "Migrations".
  • migrations.table_name: The database migrations table. Defaults to migration_versions.

Services

The service provider registers the following services which you could use:, (*4)

  • migrations.em_helper_set: The Doctrine ORM Entity Manager helper set. It would be registered if you have registered the orm.em service supposedly from the `DoctrineServiceProvider.
  • migrations.commands: An array of Symfony command instances. You could use them to add to your own Console application.

There are also a few other services which the provider uses internally and they are exposed so you could extend or override them with the lazy loading of Pimple:, (*5)

  • migrations.output_writer: Doctrine\DBAL\Migrations\OutputWriter instance used in the Doctrine migrations configuration.
  • migrations.configuration: Doctrine\DBAL\Migrations\Configuration\Configuration instance used in the console commands.
  • migrations.command_names: Array of command names. You could add your own here to be lazy loaded into migrations.commands.

You can register the provider and configure it like so:, (*6)

<?php

$app->register(
    new \Kurl\Silex\Provider\DoctrineMigrationsProvider(),
    array(
        'migrations.directory' => __DIR__ . '/../path/to/migrations',
        'migrations.name' => 'Acme Migrations',
        'migrations.namespace' => 'Acme\Migrations',
        'migrations.table_name' => 'acme_migrations',
    )
);

Silex

You can pass an optional instance of Symfony\Component\Console\Application to the constructor of the provider. Alternatively you can set the instance of your Console application to $app['console']. If the provider can find the Console application instance it is able to register the commands and helper set for you., (*7)

The provider implements `Silex\Api\BootableProviderInterface, so if you use the provider with Silex, booting the application would register the commands for you:, (*8)

<?php

$console = new \Symfony\Component\Console\Application();

$app->register(
    new \Kurl\Silex\Provider\DoctrineMigrationsProvider($console),
    array(
        'migrations.directory' => __DIR__ . '/../path/to/migrations',
        'migrations.namespace' => 'Acme\Migrations',
    )
);

$app->boot();
$console->run();

Pimple

If you use the provider with Pimple without using Silex, then you'd need to register the helper set and the commands to your Console application yourself. This is made very easy by the provider as it already registered all the needed services:, (*9)

<?php

$console = new \Symfony\Component\Console\Application();

$app->register(
    new \Kurl\Silex\Provider\DoctrineMigrationsProvider(),
    array(
        'migrations.directory' => __DIR__ . '/../path/to/migrations',
        'migrations.namespace' => 'Acme\Migrations',
    )
);

// Register helper set and commands from the `DoctrineMigrationsProvider`
$console->setHelperSet($app['migrations.em_helper_set']);
$console->addCommands($app['migrations.commands']);

$console->run();

Code coverage reports

$ bin/phpunit --coverage-html build/coverage --coverage-clover build/logs/clover.xml --log-junit build/logs/phpunit.xml

That was it!

The Versions

13/06 2018

dev-feature/doctrine-2

dev-feature/doctrine-2

A doctrine migrations provider for silex

  Sources   Download

MIT

The Requires

 

The Development Requires

13/06 2018
06/04 2018

dev-master

9999999-dev

A doctrine migrations provider for silex

  Sources   Download

MIT

The Requires

 

The Development Requires

06/04 2018
06/04 2018

dev-develop

dev-develop

A doctrine migrations provider for silex

  Sources   Download

MIT

The Requires

 

The Development Requires

06/04 2018

dev-release/0.3.1

dev-release/0.3.1

A doctrine migrations provider for silex

  Sources   Download

MIT

The Requires

 

The Development Requires

06/04 2018

dev-feature/php-versions

dev-feature/php-versions

A doctrine migrations provider for silex

  Sources   Download

MIT

The Requires

 

The Development Requires

30/05 2017
30/05 2017

dev-release/0.2.2

dev-release/0.2.2

A doctrine migrations provider for silex

  Sources   Download

MIT

The Requires

 

The Development Requires

13/11 2016
13/11 2016

dev-clippings-pimple-support

dev-clippings-pimple-support

A doctrine migrations provider for silex

  Sources   Download

MIT

The Requires

 

The Development Requires

04/01 2016

0.2.0

0.2.0.0

A doctrine migrations provider for silex

  Sources   Download

MIT

The Requires

  • php ^5.5|^7

 

The Development Requires

22/12 2014

0.1.1

0.1.1.0

A doctrine migrations provider for silex

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

15/12 2014

0.1.0

0.1.0.0

A doctrine migrations provider for silex

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires