PHPackages                             whirlwind-framework/migration-core - 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. [Database &amp; ORM](/categories/database)
4. /
5. whirlwind-framework/migration-core

ActiveLibrary[Database &amp; ORM](/categories/database)

whirlwind-framework/migration-core
==================================

Whirlwind framework migration tool interface

v0.0.3(2y ago)12921BSD-3-ClausePHPPHP &gt;=8.0

Since May 22Pushed 2y ago1 watchersCompare

[ Source](https://github.com/whirlwind-framework/migration-core)[ Packagist](https://packagist.org/packages/whirlwind-framework/migration-core)[ RSS](/packages/whirlwind-framework-migration-core/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (5)Versions (7)Used By (1)

Migration Core
==============

[](#migration-core)

Common interface for implementing Whirlwind framework database migrations.

Implementation notes
--------------------

[](#implementation-notes)

1. Create implementation of `MigrationTableGatewayInterface`. Method `queryOrCreateCollection`must create migration collection if it not exists.

```
class DummyMigrationTableGateway extends MongoTableGateway implements MigrationTableGatewayInterface
{
    protected string $collectionName = 'migrations';

    public function queryOrCreateCollection(array $conditions = [], int $limit = 0, array $order = []): array
    {
        $collection = $this->connection->listCollections(['name' => $this->collectionName]);

        if (!$collection) {
            $this->createCollection($this->collectionName);
        }

        return $this->queryAll($conditions, $order, $limit)
    }
}
```

2. Create your database implementation for `BlueprintInterface` and `BlueprintFactoryInterface`. All operation such as creating, modifying, dropping and others will be handled there.

```
class DummyBlueprint implements \Whirlwind\MigrationCore\BlueprintInterface
{
    protected string $collectionName;
    protected Query $current; // your database query builder implementation
    protected array $queries = [];

    public function __construct(string $collectionName) {
        $this->collectionName = $collectionName;
    }

    public function build(ConnectionInterface $connection): void
    {
        foreach ($queries as $query) {
            $query->execute($connection);
        }
    }

    public function create(callable $callback): void
    {
        $this->current = new Query();
        $callback($this);
        $this->queries[] = $this->current;
    }

    public function drop(): void
    {
        $this->queries[] = (new Query())->dropCollection($this->collectionName);
    }
    public function dropIfExists(): void
    {
        $this->queries[] = (new Query())->dropCollectionIfExists($this->collectionName);
    }
    public function createIfNotExists(callable $callback)
    {
        $this->create($callback);
    }
}
```

3. Create ServiceProvider for your migration tool implementation. Bind your implementations with interfaces. Also, you need to configure your module by adding `Config` dependency. For example

```
class MyDatabaseServiceProvider extends \League\Container\ServiceProvider\AbstractServiceProvider
{
    public function register(): void
    {
         $container->add(
            \Whirlwind\MigrationCore\Config\MigrationPaths::class,
            fn() => new \Whirlwind\MigrationCore\Config\MigrationPaths([
                new \Whirlwind\MigrationCore\Config\MigrationPath(
                    'path/to/your/migrations',
                    'Your\\Migration\\Namespace'
                ),
                new \Whirlwind\MigrationCore\Config\MigrationPath(
                    'path/to/your/another/migrations',
                    'Your\\Another\\Migration\\Namespace'
                ),
            ])
        );

        $container->add(
            \Whirlwind\MigrationCore\Config\Config::class,
            fn () => new \Whirlwind\MigrationCore\Config\Config(
                $container->get(\Whirlwind\MigrationCore\Config\MigrationPaths::class),
                '/path/to/your/template' // by default using template from core package
            )
        );
    }
}
```

4. Add console commands routes.

```
/**
* @var \Whirlwind\App\Console\Application $app
 */
$app->addCommand('migrate:create', \Whirlwind\MigrationCore\Command\Migration\CreateCommand::class);
$app->addCommand('migrate:install', \Whirlwind\MigrationCore\Command\Migration\InstallCommand::class);
$app->addCommand('migrate:rollback', \Whirlwind\MigrationCore\Command\Migration\RollbackCommand::class);
$app->addCommand('migrate:status', \Whirlwind\MigrationCore\Command\Migration\StatusCommand::class);
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 70% 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 ~19 days

Total

3

Last Release

1054d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a703c1aca573c9decd6f315c7bf25ae11e8e63120318c97c6ce4819133080ac8?d=identicon)[Indigerd](/maintainers/Indigerd)

---

Top Contributors

[![geckoboom](https://avatars.githubusercontent.com/u/41550729?v=4)](https://github.com/geckoboom "geckoboom (7 commits)")[![Indigerd](https://avatars.githubusercontent.com/u/2143512?v=4)](https://github.com/Indigerd "Indigerd (3 commits)")

---

Tags

migrationwhirlwindmigration core

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/whirlwind-framework-migration-core/health.svg)

```
[![Health](https://phpackages.com/badges/whirlwind-framework-migration-core/health.svg)](https://phpackages.com/packages/whirlwind-framework-migration-core)
```

###  Alternatives

[rector/rector

Instant Upgrade and Automated Refactoring of any PHP code

10.3k123.1M6.0k](/packages/rector-rector)[kitloong/laravel-migrations-generator

Generates Laravel Migrations from an existing database

2.9k7.4M24](/packages/kitloong-laravel-migrations-generator)[ssch/typo3-rector

Instant fixes for your TYPO3 PHP code by using Rector.

2592.8M263](/packages/ssch-typo3-rector)[odan/phinx-migrations-generator

Migration generator for Phinx

235847.8k23](/packages/odan-phinx-migrations-generator)[dragon-code/laravel-deploy-operations

Performing any actions during the deployment process

240173.5k2](/packages/dragon-code-laravel-deploy-operations)[cybercog/laravel-clickhouse

ClickHouse migrations for Laravel

163166.8k](/packages/cybercog-laravel-clickhouse)

PHPackages © 2026

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