nyholm/dsn

0.1.0 2018-03-03 10:37 UTC

README

Latest Version Build Status Code Coverage Quality Score Total Downloads

Install

Via Composer

composer require nyholm/dsn

Usage

The DSN parser is super simple to use. See the following example:

$dsn = new DSN('mysql://root:root_pass@127.0.0.1:3306/test_db');

$dsn->isValid();      // true
$dsn->getProtocol();  // 'mysql'
$dsn->getUsername();  // 'root'
$dsn->getPassword();  // 'root_pass'
$dsn->getFirstHost(); // '127.0.0.1'
$dsn->getFirstPort(); // 3306
$dsn->getDatabase();  // 'test_db'

Testing

$ composer test

License

The MIT License (MIT). Please see License File for more information.

Credit

This project is inpspired by SncRedisBundle and PHP-cache.