Skip to content

mikeweb85/dsn

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DSN parser

Install

Via Composer

composer require mikeweb85/dsn

Usage

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

$dsn = new DSN('mysql://root:[email protected]:3306/test_db/test_table');

$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'
$dsn->getTable();  // 'test_table'

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.

About

A simple DSN parser.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%