mikeweb85 / dsn
Parse your DSN
Installs: 13
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 11
pkg:composer/mikeweb85/dsn
Requires
- php: ^5.5 || ^7.0
Requires (Dev)
- phpunit/phpunit: ^4.8.36 || ^6.5.7 || ^7.0
This package is auto-updated.
Last update: 2025-09-24 18:54:42 UTC
README
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:root_pass@127.0.0.1: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.