PHP code example of grizz-it / micro-dbal

1. Go to this page and download the library: Download grizz-it/micro-dbal 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/ */

    

grizz-it / micro-dbal example snippets




use GrizzIt\MicroDbal\Migration\MigrationManager;
MigrationManager::addMigrationsDirectory('directory/to/migrations');



use GrizzIt\MicroDbal\Connection\ConnectionManager;

ConnectionManager::addConnection(
    'master',
    [
        'dbname' => $_ENV['DB_DATABASE'],
        'user' => $_ENV['DB_USERNAME'],
        'password' => $_ENV['DB_PASSWORD'],
        'host' => $_ENV['DB_HOST'],
        'port' => $_ENV['DB_PORT'],
        'driver' => 'pdo_mysql',
    ]
);



use GrizzIt\MicroDbal\Connection\ConnectionManager;

ConnectionManager::getConnection('master');



use GrizzIt\MicroDbal\Migration\MigrationManager;

MigrationManager::runMigrations();



use GrizzIt\MicroDbal\Migration\MigrationManager;

MigrationManager::revertMigration('2022_01_01_10_00_00_create_migrations_table.php');