PHP code example of boxunphp / mysql

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

    

boxunphp / mysql example snippets


$config = [
    'master' => [
        'host' => 'mysql-3306',
        'port' => 3306,
        'username' => 'root',
        'password' => '123456',
        'dbname' => 'test',
        'charset' => 'utf8',
    ],
    'slaves' => [
        [
            'host' => 'mysql-3307',
            'port' => 3307,
            'username' => 'root',
            'password' => '123456',
            'dbname' => 'test',
            'charset' => 'utf8',
        ],
        [
            'host' => 'mysql-3308',
            'port' => 3308,
            'username' => 'root',
            'password' => '123456',
            'dbname' => 'test',
            'charset' => 'utf8',
        ],
    ],
    'connect_timeout' => 1,
    'timeout' => 1,
    'is_persistent' => true,
];