bluefrg/parsepdodsn

用于解析PHP的PDO字符串的类。

1.0.0 2019-09-04 22:23 UTC

This package is auto-updated.

Last update: 2024-09-05 09:30:10 UTC


README

一个简单的库,用于解析和解释PDO DSN字符串。

<?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()); 

安装

$ composer require bluefrg/parsepdodsn