icecave/lace

This package is abandoned and no longer maintained. No replacement package was suggested.

A DSN parser for Doctrine databases and cache drivers.

0.1.0 2014-08-26 09:24 UTC

This package is not auto-updated.

Last update: 2020-01-20 03:37:47 UTC


README

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