horat1us/yii2-migration-bootstrap

Yii2 Migrations Bootstrap

1.3.0 2022-11-14 14:00 UTC

This package is auto-updated.

Last update: 2024-10-30 01:48:22 UTC


README

Test & Lint codecov

This package provides \yii\base\BootstrapInterface implementation to append packages migrations to console application.
Main purpose is to prevent mistakes while re-configuring console application.

Previous implementation was available in horat1us/yii2-base package as BootstrapMigrations trait.

Installation

Using packagist.org:

composer require horat1us/yii2-migration-bootstrap:^1.0

Structure

  • BootstrapTrait - base implementation, can be used outside \yii\base\BootstrapInterface implementation.
  • Bootstrap - yii\base\BootstrapInterface implementation using BootstrapTrait

Example

Implement \yii\base\BootstrapInterface in your yii2 package:

<?php

namespace Package;

use Horat1us\Yii;

class Bootstrap extends Yii\Migration\Bootstrap
{
    public $namespaces = __NAMESPACE__ . "\\Migrations";
    
    public $aliases = ['Package' => '@vendor/developer/package/src'];
}

Then add to application bootstraps:

<?php

// config.php

use Package;

return [
    'bootstrap' => [
        'class' => Package\Bootstrap::class,    
    ],
    // ... another application config
];

License

MIT