PHPackages                             mac2000/silex\_migrations\_service\_provider - 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. [Framework](/categories/framework)
4. /
5. mac2000/silex\_migrations\_service\_provider

AbandonedArchivedLibrary[Framework](/categories/framework)

mac2000/silex\_migrations\_service\_provider
============================================

Silex Migrations Service Provider

02PHP

Since Sep 6Pushed 12y ago1 watchersCompare

[ Source](https://github.com/mac2000/silex_migrations_service_provider)[ Packagist](https://packagist.org/packages/mac2000/silex_migrations_service_provider)[ RSS](/packages/mac2000-silex-migrations-service-provider/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Silex Migrations Service Provider
=================================

[](#silex-migrations-service-provider)

This service provider will give you ability to easily migrate your schema directly from browser.

Installation
------------

[](#installation)

Add to your `composer.json`:

```
"minimum-stability": "dev",
"repositories": [
    {
        "type": "package",
        "package": {
            "name": "mac2000/silex_migrations_service_provider",
            "version": "dev-master",
            "source": {
                "type": "git",
                "url": "git://github.com/mac2000/silex_migrations_service_provider.git",
                "reference": "master"
            },
            "autoload": {
                "psr-0": {
                    "": "src"
                }
            }
        }
    }
],
"require": {
    "silex/silex": "1.*",
    "mac2000/silex_migrations_service_provider": "dev-master"
},

```

Register Service Provider
-------------------------

[](#register-service-provider)

```
$app->register(new MigrationsServiceProvider(), array(
    'migration.table' => 'version', // Optional argument - table name where migrations log will be stored, will be created automatically, default value is: doctrine_migration_versions
    'migration.namespace' => 'Acme\\Migration', // Namespace where your migration classes can be found, do not forget about slash escaping and do not add last slash
    'migration.directory' => 'src/Acme/Migration' // Directory where your migration classes can be found
));

```

Usage examples
--------------

[](#usage-examples)

```
$versions = $app['migration']->getSql();
$versions = $app['migration']->migrate();

```

Migrations Trait
----------------

[](#migrations-trait)

```
use MigrationsTrait;
...
$app->migration()->getSql();
$app->migration()->migrate();

```

Run tests
---------

[](#run-tests)

```
vendor/bin/phpunit
vendor/bin/phpunit --coverage-html ./report

```

Demo Application
----------------

[](#demo-application)

There is `demo` application in source where you can find fully functional application example.

The only thing you need to do is run:

```
mysql -uroot -proot -e "CREATE DATABASE silex_migrations_service_provider_example"

```

Migration examples can be found here: `demo/Acme/Migrations/Version*.php`

Version class examples
======================

[](#version-class-examples)

Using Raw SQL
-------------

[](#using-raw-sql)

Can be found in `demo/Acme/Migrations/Version*.php`

Doctrine
--------

[](#doctrine)

```
class Version1 extends AbstractMigration
{
    public function up(Schema $schema)
    {
        $people = $schema->createTable('people');
        $people->addColumn('id', 'integer', array('unsigned' => true, 'autoincrement' => true));
        $people->addColumn('first_name', 'string', array('length' => 128));
        $people->addColumn('last_name', 'string', array('length' => 128));
        $people->setPrimaryKey(array('id'));
    }

    public function postUp(Schema $schema)
    {
        $this->connection->insert('people', array(
            'first_name' => 'Alexandr',
            'last_name' => 'Marchenko'
        ));

        $this->connection->insert('people', array(
            'first_name' => 'Maria',
            'last_name' => 'Marchenko'
        ));
    }

    public function down(Schema $schema)
    {
        $schema->dropTable('people');
    }
}

class Version2 extends AbstractMigration {

    public function up(Schema $schema)
    {
        $people = $schema->getTable('people');
        $people->addColumn('full_name', 'string', array('length' => 256));
    }

    public function postUp(Schema $schema) {
        $this->connection->createQueryBuilder()->update('people')->set('full_name', "CONCAT(first_name, ' ', last_name)")->execute();
    }

    public function down(Schema $schema)
    {
        $people = $schema->getTable('people');
        $people->dropColumn('full_name');
    }
}

class Version3 extends AbstractMigration {

    public function up(Schema $schema)
    {
        $people = $schema->getTable('people');
        $people->dropColumn('first_name');
        $people->dropColumn('last_name');
    }

    public function down(Schema $schema)
    {
        $people = $schema->getTable('people');
        $people->addColumn('first_name', 'string', array('length' => 128));
        $people->addColumn('last_name', 'string', array('length' => 128));
    }

    public function postDown(Schema $schema) {
        $this->connection->createQueryBuilder()->update('people')->set('first_name', "SUBSTRING_INDEX(full_name, ' ', 1)")->set('last_name', "SUBSTRING_INDEX(full_name, ' ', -1)")->execute();
    }
}

```

What you should notice is that you can not change schema and data at same time.

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/584d9123f394548ae52dace4188a80ab5c3695f481271cf859ad26a94b86e021?d=identicon)[mac2000](/maintainers/mac2000)

---

Top Contributors

[![marchenko1985](https://avatars.githubusercontent.com/u/88868?v=4)](https://github.com/marchenko1985 "marchenko1985 (7 commits)")

### Embed Badge

![Health badge](/badges/mac2000-silex-migrations-service-provider/health.svg)

```
[![Health](https://phpackages.com/badges/mac2000-silex-migrations-service-provider/health.svg)](https://phpackages.com/packages/mac2000-silex-migrations-service-provider)
```

###  Alternatives

[laravel/telescope

An elegant debug assistant for the Laravel framework.

5.2k67.8M192](/packages/laravel-telescope)[spiral/roadrunner

RoadRunner: High-performance PHP application server and process manager written in Go and powered with plugins

8.4k12.2M84](/packages/spiral-roadrunner)[nolimits4web/swiper

Most modern mobile touch slider and framework with hardware accelerated transitions

41.8k177.2k1](/packages/nolimits4web-swiper)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M259](/packages/laravel-dusk)[laravel/prompts

Add beautiful and user-friendly forms to your command-line applications.

708181.8M596](/packages/laravel-prompts)[cakephp/chronos

A simple API extension for DateTime.

1.4k47.7M121](/packages/cakephp-chronos)

PHPackages © 2026

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