PHP code example of hiyan / phpenalva
1. Go to this page and download the library: Download hiyan/phpenalva 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/ */
hiyan / phpenalva example snippets
use Core\BaseMigration;
class CreateUsersTable extends BaseMigration
{
public function up()
{
$this->execute("CREATE TABLE IF NOT EXISTS users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name VARCHAR(100),
email VARCHAR(100) UNIQUE,
password VARCHAR(255),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)");
}
public function down()
{
$this->execute("DROP TABLE IF EXISTS users");
}
}