Skip to content
This repository has been archived by the owner on Nov 20, 2017. It is now read-only.
/ lace Public archive

A DSN parser for Doctrine databases and cache drivers.

License

Notifications You must be signed in to change notification settings

IcecaveStudios/lace

Repository files navigation

Lace

Build Status Test Coverage SemVer

Lace is a DSN parser for Doctrine database and cache connections.

Lace was initially created to parse DSN URIs stored in environment variables on the Heroku platform.

Examples

Database DSN

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
)

Cache DSN

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
)

Contact us

About

A DSN parser for Doctrine databases and cache drivers.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages