PHPackages                             elao/command-migration - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [DevOps &amp; Deployment](/categories/devops)
4. /
5. elao/command-migration

ActiveLibrary[DevOps &amp; Deployment](/categories/devops)

elao/command-migration
======================

PHP lib to run commands, for example on deployment.

v0.2.3(7y ago)510MITPHPPHP &gt;=7.2.0

Since Nov 13Pushed 7y ago12 watchersCompare

[ Source](https://github.com/Elao/CommandMigration)[ Packagist](https://packagist.org/packages/elao/command-migration)[ RSS](/packages/elao-command-migration/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (7)Versions (6)Used By (0)

CommandMigration
================

[](#commandmigration)

PHP library to run commands, for example on deployment.

Why
---

[](#why)

Sometimes, on deployment or when switching to a branch, we need to run some migration commands, for example reindex a database, calculate aggregation, remove whatever uploaded files...

Do not do it manually anymore by connecting to your server in ssh! This library allow you to declare in your feature git branch what command(s) need to be run once deployed.

Install
-------

[](#install)

```
$ composer require elao/command-migration

```

**Enable the bundle on Symfony &lt;= 3.4 (app/AppKernel.php)**

```
public function registerBundles()
{
    $bundles = array(
        // ...
        new Elao\CommandMigration\Bridge\Symfony\Bundle\CommandMigrationBundle(),
        // ...
    );
}

```

**Enable the bundle on Symfony 4 (config/bundles.php)**

```
return [
    // ...
    Elao\CommandMigration\Bridge\Symfony\Bundle\CommandMigrationBundle::class => ['all' => true],
    // ...
];

```

Add a `elao_command_migration.yaml` file (in a not public directory of course!):

```
elao_command_migration:
    storage:
        type: dbal
        dsn: '%env(DATABASE_DSN)%'
        table_name: 'command_migrations'
    migrations: []
```

Usage
-----

[](#usage)

Declare what command(s) need to be run in the `migrations` entry in your `elao_command_migration.yaml` file:

```
elao_command_migration:
    # ...
    migrations:
        whateverUniqueIdentifier:
            - php bin/console app:posts:reindex
        20180510173033:
            - php bin/console app:posts:reindex
            - php bin/console doctrine:migrations:migrate
        20180622110900:
            - php bin/console app:posts:reindex
            - node hello-world.js
            - php bin/console doctrine:schema:update --force
            - rm -rf public/uploads/lolcats
            - php bin/console app:recalculate:turnover
```

Entries in `migrations` could have whatever identifier, but we recommend to use a date + time format: YYYYMMDDHHMMSS

Run `php bin/elao-command-migration path/to/elao_command_migration.yaml` to test it.

Integration
-----------

[](#integration)

Add `php bin/elao-command-migration path/to/elao_command_migration.yaml`to your deployment process.

### Capifony

[](#capifony)

Set in deploy.rb:

```
    after :deploy, 'app_tasks:elao_command_migration'

    namespace :app_tasks do
      task :elao_command_migration do
        capifony_pretty_print "--> Run command migrations"
        invoke_command "php bin/elao-command-migration path/to/elao_command_migration.yaml", :via => run_method
        capifony_puts_ok
      end
    end
```

### Ansible

[](#ansible)

With [Manala/ansible-role-deploy](https://github.com/manala/ansible-role-deploy), add in `ansible/group_vars/deploy.yml`:

```
    manala_deploy_tasks:
      - command: php bin/elao-command-migration path/to/elao_command_migration.yaml
```

or

```
    manala_deploy_post_tasks:
      - command: php bin/elao-command-migration path/to/elao_command_migration.yaml
```

How it works
------------

[](#how-it-works)

CommandMigration is very inspired by [Doctrine Migrations](https://github.com/doctrine/migrations) but for running commands.

The `elao:command-migration:run` command :

- Fetch all migrations already ran from `command_migrations` database table
- Get only migrations not already ran from `elao_command_migration.migrations`
- Store migration identifier in `command_migrations` database table.

Clean old migrations
--------------------

[](#clean-old-migrations)

When the commands have been deployed and ran on production environment, you can (manually) delete the entries in `elao_command_migration.migrations`.

Who is using it?
----------------

[](#who-is-using-it)

- [Vimeet](https://vimeet.events/)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 63.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~15 days

Total

5

Last Release

2670d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/156850a5601e6fe41cbc75ff2c4a4a78caf0502df9db8ec1165ec4370b7de616?d=identicon)[Elao](/maintainers/Elao)

---

Top Contributors

[![NicolasDievart](https://avatars.githubusercontent.com/u/4649817?v=4)](https://github.com/NicolasDievart "NicolasDievart (7 commits)")[![supertanuki](https://avatars.githubusercontent.com/u/1101620?v=4)](https://github.com/supertanuki "supertanuki (3 commits)")[![mmarchois](https://avatars.githubusercontent.com/u/2683379?v=4)](https://github.com/mmarchois "mmarchois (1 commits)")

---

Tags

continuous-integrationdeploymentsymfony

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/elao-command-migration/health.svg)

```
[![Health](https://phpackages.com/badges/elao-command-migration/health.svg)](https://phpackages.com/packages/elao-command-migration)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M646](/packages/sylius-sylius)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[shopware/deployment-helper

Shopware deployment tools

19305.3k5](/packages/shopware-deployment-helper)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19462.3M1.3k](/packages/drupal-core)[contao/core-bundle

Contao Open Source CMS

1231.6M2.3k](/packages/contao-core-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
