bluefrg / parsepdodsn
A class for parsing PHP's PDO strings.
1.0.0
2019-09-04 22:23 UTC
Requires
- php: >=7.1
Requires (Dev)
- phpunit/phpunit: ^8
This package is auto-updated.
Last update: 2024-12-22 23:16:13 UTC
README
A simple library to parse and interpret a PDO DSN string.
<?php $dsn = Bluefrg\ParsePdoDsn\Dsn::parse('mysql:host=localhost;dbname=testdb'); // Get the prefix echo $dsn->getPrefix(); // mysql // Fetch an element's value echo $dsn->element('host'); // localhost echo $dsn->element('dbname'); // testdb // List all elements as key-values print_r($dsn->getElements());
Install
$ composer require bluefrg/parsepdodsn