Lace is a DSN parser for Doctrine database and cache connections.
- Install via Composer package icecave/lace
- Read the API documentation
Lace was initially created to parse DSN URIs stored in environment variables on the Heroku platform.
The DatabaseDsnParser
class is responsible for parsing database DSNs into arrays compatible with
Doctrine DBAL's driver manager.
The following drivers are currently supported:
- PostgreSQL
- MySQL
- SQLite
use Icecave\Lace\DatabaseDsnParser;
$parser = new DatabaseDsnParser;
$options = $parser->parse('postgres://username:password@hostname:1234/database');
print_r($options);
Array
(
[driver] => pdo_pgsql
[user] => username
[password] => password
[host] => hostname
[port] => 1234
[dbname] => database
)
The CacheDsnParser
class is responsible for parsing DSNs into arrays with the necessary information.
The following drivers are currently supported:
- Redis
use Icecave\Lace\CacheDsnParser;
$parser = new CacheDsnParser;
$options = $parser->parse('redis://username:password@hostname:1234');
print_r($options);
Array
(
[host] => hostname
[port] => 1234
[password] => password
)
- Follow @IcecaveStudios on Twitter
- Visit the Icecave Studios website
- Join
#icecave
on irc.freenode.net