/yii-dsn-helper

Primary LanguagePHPMIT LicenseMIT

Dsn connection string parsing

parsing dsn connection strings for most databases.

Usage

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;