PHP code example of wp-content-framework / db

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

    

wp-content-framework / db example snippets


// テーブル名 => 設定
'test' => array(

    // primary key 設定
    'id'      => 'test_id',     // optional [default = $table_name . '_id']

    // カラム 設定
    'columns' => array(

        // 論理名 => 設定
        'name'   => array(
            'name'     => 'name_test',     // optional (物理名)
            'type'     => 'VARCHAR(32)',   //    => false,
            'default' => 'test',
        ),
        'value2' => array(
            'type'    => 'VARCHAR(32)',
            'comment' => 'aaaa',
        ),
        'value3' => array(
            'type'    => 'INT(11)',
            'null'    => false,
            'comment' => 'bbb',
        ),
    ),

    // index 設定
    'index'   => array(
        // key index
        'key'    => array(
            'name' => array( 'name' ),
        ),

        // unique index
        'unique' => array(
            'value' => array( 'value1', 'value2' ),
        ),
    ),

    // 論理削除 or 物理削除
    'delete'  => 'logical', // physical or logical [default = physical]

    // コメント
    'comment' => 'test,
),