| Recommend this page to a friend! | 
|  Download | 
| Info | Example |  Files |  Install with Composer |  Download | Reputation | Support forum | Blog | Links | 
| Ratings | Unique User Downloads | Download Rankings | ||||
| Not yet rated by the users | Total: 64 | All time:  10,420 This week: 455  | ||||
| Version | License | PHP version | Categories | |||
| phpmigration 1.0 | Custom (specified... | 7 | Databases, PHP 7 | 
| Description | Author | |
| This package can run database schema database migration operations. | 
| 
<?php | 
Migration Library for PHP
include_once __DIR__ . '/src/Database.php';
include_once __DIR__ . '/src/Utils.php';
include_once __DIR__ . '/src/Migration.php';
include_once __DIR__ . '/config.php';
use Farisc0de\PhpMigration\Database;
use Farisc0de\PhpMigration\Options\Options;
use Farisc0de\PhpMigration\Options\Types;
use Farisc0de\PhpMigration\Utils;
use Farisc0de\PhpMigration\Migration;
$obj = new Migration(new Database($config), new Utils());
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    // Create a new table
    $obj->createTable(
        "users",
        ["id", Types::Integer(), Options::AutoIncrement(), Options::NotNull()],
        ["username", Types::String(255), Options::NotNull()],
        ["password", Types::String(255), Options::NotNull()],
        ["email", Types::String(255), Options::NotNull()],
        ["created_at", Types::TimeStamp(), Options::CurrentTimeStamp()],
        ["updated_at", Types::TimeStamp(), Options::CurrentTimeStamp()]
    );
    // Create Primary Key
    $obj->setPrimary("users", "id");
    // Add a new record
    $obj->insertValue(
        "users",
        [
            "username" => "admin",
            "password" => password_hash("admin", PASSWORD_DEFAULT),
            "email" => "[email protected]",
        ]
    );
    $msg = "Database installed successfully!";
FarisCode
|  Files (11) | 
| File | Role | Description | ||
|---|---|---|---|---|
|  example (2 files) | ||||
|  src (3 files, 1 directory) | ||||
|    .phpcs.xml | Data | Auxiliary data | ||
|    composer.json | Data | Auxiliary data | ||
|    LICENSE | Lic. | License text | ||
|    README.md | Doc. | Documentation | ||
|  Files (11) | / | example | 
| File | Role | Description | 
|---|---|---|
|    config.php | Aux. | Auxiliary script | 
|    install.php | Example | Example script | 
|  Files (11) | / | src | 
| File | Role | Description | ||
|---|---|---|---|---|
|  Options (2 files) | ||||
|  Database.php | Class | Class source | ||
|  Migration.php | Class | Class source | ||
|  Utils.php | Class | Class source | ||
|  Files (11) | / | src | / | Options | 
| File | Role | Description | 
|---|---|---|
|  Options.php | Class | Class source | 
|  Types.php | Class | Class source | 
| The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. | 
|  Install with Composer | 
| Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
| 100% | 
 | 
 | 
| Applications that use this package | 
 If you know an application of this package, send a message to the author to add a link here.
 If you know an application of this package, send a message to the author to add a link here.