PHP code example of cakephp / datasource

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

    

cakephp / datasource 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);