PHP code example of hiblaphp / schema-manager

1. Go to this page and download the library: Download hiblaphp/schema-manager 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/ */

    

hiblaphp / schema-manager example snippets




use Hibla\SchemaManager\Schema\Blueprint;
use Hibla\SchemaManager\Schema\Migration;
use function Hibla\await;

return new class extends Migration {
    public function up(): void {
        await($this->create('users', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('email')->unique();
            $table->timestamps();
        }));
    }

    public function down(): void {
        await($this->dropIfExists('users'));
    }
};



use Hibla\SchemaManager\Schema\Seeder;
use function Hibla\await;

return new class extends Seeder {
    public function run(): void {
        await($this->db('users')->insertBatch([
            ['name' => 'Alice', 'email' => '[email protected]'],
            ['name' => 'Bob', 'email' => '[email protected]'],
        ]));
    }
};