PHP code example of tobento / app-migration

1. Go to this page and download the library: Download tobento/app-migration library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tobento / app-migration example snippets


use Tobento\App\AppFactory;

// Create the app
$app = (new AppFactory())->createApp();

// Adding boots
$app->boot(\Tobento\App\Migration\Boot\Migration::class);

// Run the app
$app->run();

use Tobento\App\Boot;
use Tobento\App\Migration\Boot\Migration;

class AnyServiceBoot extends Boot
{
    public const BOOT = [
        // you may ensure the migration boot.
        Migration::class,
    ];
    
    public function boot(Migration $migration)
    {
        // Install migrations
        $migration->install(AnyMigration::class);
        
        // Uninstall migrations
        $migration->uninstall(AnyMigration::class);
        
        // Install migrations with app macro
        $this->app->install(AnyMigration::class);
        
        // Uninstall migrations with app macro
        $this->app->uninstall(AnyMigration::class);        
    }
}

php ap migration:list

php ap migration:install --name=Namespace\Migration

php ap migration:install --id=12|23

php ap migration:install --type=database|views

php ap migration:uninstall --name=Namespace\Migration

php ap migration:uninstall --id=12|23