PHP code example of indievox / master-slave-db-access
1. Go to this page and download the library: Download indievox/master-slave-db-access 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/ */
indievox / master-slave-db-access example snippets
composer
use iNDIEVOX\MasterSlaveDBAccess\MasterSlaveDBAccess;
$db_config = array(
"database_server" => array(
"master"=>array(
"db_host"=>'localhost', // change to your master host
"db_name"=>'homestead', // change to your master database name
"db_user"=>'root', // change to your master database username
"db_password"=>'' // change to your master database password
),
"slave1"=>array(
"db_host"=>'localhost', // change to your slave host
"db_name"=>'homestead', // change to your slave database name
"db_user"=>'root', // change to your slave database username
"db_password"=>'' // change to your slave database password
),
"slave2"=>array(
"db_host"=>'localhost', // change to your slave host
"db_name"=>'homestead', // change to your slave database name
"db_user"=>'root', // change to your slave database username
"db_password"=>'' // change to your slave database password
)
),
"slave_database_name" => array(
'slave1',
'slave2'
)
);