icecave / lace
A DSN parser for Doctrine databases and cache drivers.
Installs: 2 289
Dependents: 1
Suggesters: 0
Security: 0
Stars: 4
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=5.5
Requires (Dev)
- icecave/archer: ~1
Suggests
- eloquent/asplode: Drop-in exception-based error handling.
This package is not auto-updated.
Last update: 2020-01-20 03:37:47 UTC
README
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.
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
- Follow @IcecaveStudios on Twitter
- Visit the Icecave Studios website
- Join
#icecave
on irc.freenode.net