bluefrg / parsepdodsn
A class for parsing PHP's PDO strings.
Installs: 316
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/bluefrg/parsepdodsn
Requires
- php: >=7.1
Requires (Dev)
- phpunit/phpunit: ^8
This package is auto-updated.
Last update: 2025-09-23 00:55:53 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