PHP code example of thefinaloutpost / cakedatasource

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

    

thefinaloutpost / cakedatasource example snippets


use Cake\Datasource\ConnectionManager;

ConnectionManager::config('connection-one', [
    'className' => 'MyApp\Connections\CustomConnection',
    'param1' => 'value',
    'param2' => 'another value'
]);

ConnectionManager::config('connection-two', [
    'className' => 'MyApp\Connections\CustomConnection',
    'param1' => 'different value',
    'param2' => 'another value'
]);

use Cake\Datasource\ConnectionManager;
$conn = ConnectionManager::get('master');

use Cake\Datasource\ConnectionManager;
$conn = ConnectionManager::config('other', $connectionInstance);