PHP code example of phlib / db-helper-replication

1. Go to this page and download the library: Download phlib/db-helper-replication 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/ */

    

phlib / db-helper-replication example snippets


composer 

$config = ion = Replication::createFromConfig($config);

while ([...]) {
    [... some repetitive iteration, like writing thousands of records ...]
    
    $replication->throttle();
}


$config = [
    // primary
    'host'     => '10.0.0.1',
    'username' => 'foo',
    'password' => 'bar',
    'replicas' => [
        [
            'host'     => '10.0.0.2',
            'username' => 'foo',
            'password' => 'bar',
        ],
    ],
    'storage' => [
        'class' => \Phlib\DbHelperReplication\Replication\Memcache::class,
        'args'  => [[]],
    ],
];

return $config;