PHP code example of e-kevin / yii-dsn-helper

1. Go to this page and download the library: Download e-kevin/yii-dsn-helper 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/ */

    

e-kevin / yii-dsn-helper example snippets


use ekevin\dsn\Dsn;

// parse dsn
$dsn = Dsn::parse("mysql:host='localhost';dbname='testDb';port=3306");

// build dsn
$dsn = Dsn::build([
    'scheme'   => 'mysql',
    'hostname' => 'localhost',
    'port'     => '3306',
    'dbname'   => 'testDb',
])->dsn;