PHP code example of gam6itko / cycle-nyholm-dsn-bridge

1. Go to this page and download the library: Download gam6itko/cycle-nyholm-dsn-bridge 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/ */

    

gam6itko / cycle-nyholm-dsn-bridge example snippets


# app/config/database.php

return [
    'default' => env('DATABASE_DEFAULT_DRIVER', 'my-db'),

    'databases' => [
        'my-db' => [
            'connection' => 'mysql.db',
        ],
    ],

    'connections' => [
        'mysql.db' => new MySQLDriverConfig(
            // 'mysql:host=mysql;dbname=testdb;charset=utf8mb4', 'user', 'pass'
            new NyholmDsnConnectionConfig('mysql://user:pass@mysql:3306/testdb?charset=utf8mb4')
        ),
    ],
];