PHP code example of bubu-framework / database

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

    

bubu-framework / database example snippets


    Database::createTable('test')->addColumn(
        Database::createColumn('col1')
        ->type(CreateColumn::INT)
        ->size(10)
        ->defaultValue(30)
        ->comments("It's ok")
        ->notNull()
        )
        ->addColumn(
            Database::createColumn('id')
                ->type(CreateColumn::INT)
                ->size(11)
                ->autoIncrement()
        )
        ->addIndex([
            'type' => 'primary',
            'columns' => ['id'],
            'name' => 'primaryKey'
        ])
        ->addIndex([
            'type' => CreateTable::UNIQUE_INDEX,
            'columns' => ['col1', 'id'],
            'name' => 'uniqueKey'
        ])
        ->execute();