PHP code example of furkifor / sql_dumper

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

    

furkifor / sql_dumper example snippets


$sql_dumper = new Furkifor\SqlDumper("TABLE_NAME");
echo $sql_dumper->select('*')->get();
// select * from TABLE_NAME 

$table = new MigrateClass("mysql");
$table->name("users")
    ->string('username',255)->unique()->notnull()
    ->string('email',255)->unique()->notnull()
    ->string('password',255)->notnull()
    ->datetime('created_at')->default("CURRENT_TIMESTAMP")
    ->int('role_id')->notnull()->foreignKey('roles','id')->check("role_id>0")
    ->createTable();
/*
CREATE TABLE users (
  id INT(11) AUTO_INCREMENT PRIMARY KEY NOT NULL,
  username VARCHAR(255) NOT NULL UNIQUE,
  email VARCHAR(255) NOT NULL UNIQUE,
  password VARCHAR(255) NOT NULL,
  created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
  role_id INT NOT NULL,
  FOREIGN KEY (role_id) REFERENCES roles(id),
  CHECK (role_id > 0)
)
*/