1. Go to this page and download the library: Download piko/migrate 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/ */
return new class {
public function up(PDO $db): void
{
$db->exec('CREATE TABLE users (id INT PRIMARY KEY AUTO_INCREMENT, name VARCHAR(120) NOT NULL)');
}
public function down(PDO $db): void
{
$db->exec('DROP TABLE users');
}
};
bash
composer install
php ./bin/migrate --help
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.