Introduction
babelqueue/php-sdk is the framework-agnostic PHP core: the wire-envelope
codec, contracts, validation and dead-letter helpers. It is the single PHP
implementation of the wire format, so the framework adapters reuse it and can
never drift.
Most PHP applications don’t install this directly — they install an adapter, which pulls the core in:
Install the core directly only for a framework-less PHP app, or to build a new adapter.
What you get
EnvelopeCodec— build (make/fromJob),encode,decode,urnandacceptsfor the canonical{job, trace_id, data, meta, attempts}envelope (schema_version: 1).- Contracts —
PolyglotJob(getBabelUrn()+toPayload()),HasTraceId,InboundMessage, and a minimalTransportseam. EnvelopeValidator— consumer-side validation with a reason, so you can quarantine an unsupportedschema_versioninstead of dropping it.- Reference transports — optional framework-less
RedisTransport/AmqpTransport. - Dead-letter + unknown-URN strategies, and a dependency-free UUIDv4.
Zero heavy dependencies — PHP ^8.2 and ext-json only.
Not a worker
This core is the contract runtime, not a runtime worker: it has no broker loop and no retry. The adapters bind to each framework’s native queue (Laravel’s drop-in driver, Symfony Messenger) and reuse that framework’s worker and retry.
The envelope
{
"job": "urn:babel:orders:created",
"trace_id": "7b3f9c2a-e41d-4f88-9b2a-1c0d5e6f7a8b",
"data": { "order_id": 1042 },
"meta": { "id": "f1e2d3c4-b5a6-4789-90ab-cdef01234567", "queue": "orders", "lang": "php", "schema_version": 1, "created_at": 1749132727000 },
"attempts": 0
}
See the full wire contract. Continue to Installation.