enqueue/dsn
Parse and work with Enqueue DSNs (connection strings) for message queue transports. Lightweight PHP utility to read DSN options and parameters, used across the Enqueue ecosystem. MIT licensed.
enqueue/dsn package is a minimal, focused tool for parsing DSN (Data Source Name) strings (e.g., amqp://user:pass@host:port/vhost). It aligns well with systems requiring message queue configuration parsing (e.g., RabbitMQ, SQS, Redis Streams) without adding heavy dependencies.parse() method, requiring minimal effort to integrate. Example:
use Enqueue\Dsn;
$dsn = 'amqp://user:pass@localhost:5672/%2f';
$parsed = Dsn::parse($dsn);
// Returns: ['scheme' => 'amqp', 'user' => 'user', 'pass' => 'pass', ...]
php artisan queue:parse-dsn).Illuminate/Support/Str or Symfony’s Url component, weigh the tradeoff between specialized parsing (this package) vs. general-purpose utilities.redis://[::1]:6379/0).php-enqueue?
Url).ConnectionFactory, this package can pre-process DSNs before instantiation:
$dsn = 'amqp://...';
$config = Dsn::parse($dsn);
$connection = Enqueue\AmqpExt\AmqpConnectionFactory::createConnection($config);
Url: More feature-rich but heavier.composer require enqueue/dsn
'amqp://user:pass@host' with parsed arrays in config files or services.amqp, amqps, redis, redis+sentinel, generic (e.g., tcp://).config:cache.composer.json and test parsing in a non-critical path (e.g., a CLI command)..env parsing).vendor/dsn-parser).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Invalid DSN format | Parsing fails; app crashes or uses defaults. | Validate with try-catch or fallback to manual parsing. |
| Unsupported DSN scheme | Partial parsing; unexpected behavior. | Extend the package or pre-filter schemes. |
| PHP version incompatibility | Package fails on PHP <7.1. | Use a polyfill or replace with Symfony’s Url. |
| Fork abandonment | No updates if community drops support. | Fork early and maintain independently. |
Dsn::parse()) with clear return structure.amqp://, redis://).How can I help you explore Laravel packages today?