Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Php Sdk Laravel Package

babelqueue/php-sdk

Framework-agnostic core of BabelQueue for PHP: the canonical polyglot queue envelope codec, contracts, validation, transports, dead-letter and idempotency helpers that all framework adapters (Laravel, Symfony) build on. Install directly only for framework-less apps or new adapters.

View on GitHub
Deep Wiki
Context7

BabelQueue PHP SDK is the framework-agnostic core of BabelQueue for PHP: the canonical polyglot queue envelope codec, contracts, and dead-letter helpers that framework adapters (babelqueue/laravel, babelqueue/symfony) build upon. Install it directly only for framework-less apps or when writing a new adapter.

It defines the single PHP implementation of the {job, trace_id, data, meta, attempts} wire format (schema_version 1), so Laravel and Symfony can't drift.

  • EnvelopeCodec builds, encodes, and decodes the canonical envelope.
  • EnvelopeValidator validates consumer-side with a reason, so unsupported versions can be quarantined.
  • Idempotency stores (PDO/Redis) use atomic claims to dedupe concurrent deliveries.
  • DeadLetter and Redrive helpers annotate and requeue failed messages.
  • Optional RedisTransport and AmqpTransport reference implementations.
Frequently asked questions about Php Sdk
Do I need to install babelqueue/php-sdk directly in a Laravel application?
You normally install babelqueue/laravel, not the core SDK directly. The Laravel adapter pulls babelqueue/php-sdk in as a dependency and reuses its canonical EnvelopeCodec, contracts and helpers. Install babelqueue/php-sdk directly only for framework-less PHP applications or when building a new adapter.
What does the BabelQueue envelope look like and what is schema_version 1?
The canonical envelope is the JSON object {job, trace_id, data, meta, attempts} with meta.schema_version set to 1. BabelQueue\Codec\EnvelopeCodec is the single PHP implementation of that wire format, so every framework adapter reuses the same build, encode and decode logic. That shared codec is what keeps Laravel and Symfony producers from drifting apart.
Does babelqueue/php-sdk work with Laravel 10 or 11, and which PHP versions are supported?
The SDK itself is framework-agnostic, so Laravel version and PHP version constraints are defined by the adapter you install, such as babelqueue/laravel. Check that adapter's composer.json for its exact illuminate and PHP requirements. The core package focuses on the envelope codec, contracts, validation, transports and helpers rather than Laravel framework integration.
How do I validate an incoming BabelQueue envelope and quarantine unsupported schema versions?
Use BabelQueue\Validation\EnvelopeValidator on the consumer side. It validates an envelope with a reason, so you can quarantine or dead-letter an unsupported meta.schema_version instead of silently dropping the message. Pair that with CI checks and semantic versioning of your envelope contracts to catch schema drift early.
Can I use babelqueue/php-sdk without Laravel, such as in plain PHP or Symfony?
Yes. The package is explicitly the framework-agnostic core, so it can be used in plain PHP or behind another framework adapter. It ships a minimal Transport contract plus optional RedisTransport and AmqpTransport reference implementations. A Symfony adapter also exists for Messenger-style integration.
Which queue transports does babelqueue/php-sdk include out of the box?
The SDK includes optional framework-less RedisTransport, which publishes with Redis RPUSH, and AmqpTransport, which targets RabbitMQ with durable queues and contract AMQP properties. Both implement the BabelQueue\Contracts\Transport publish seam. You can also implement Transport yourself for another broker or for a custom Laravel queue worker.
How does dead-letter handling work with BabelQueue envelopes?
BabelQueue\DeadLetter annotates an envelope with the additive dead_letter block described in ADR-0009. This lets consumers preserve the original message and validation reason when a message cannot be processed. Combine it with EnvelopeValidator so malformed or unsupported envelopes are quarantined rather than discarded.
How do I make BabelQueue consumers idempotent across multiple workers?
Use BabelQueue\Idempotency\Idempotent::wrap($store, $handler) to skip messages whose meta.id has already been processed. For a fleet, use a claiming store such as PdoStore or RedisStore, which perform an atomic claim through a PDO unique insert or Redis SET NX PX. That serializes concurrent deliveries of the same id so only one worker handles it.
How do I redrive failed or dead-lettered BabelQueue messages safely?
Use the BabelQueue\Redrive\Redrive helpers to republish failed or dead-lettered envelopes after you inspect or fix them. Keep the dead_letter annotation and idempotency store in place so a redrive does not double-process a message. That gives you a controlled recovery path instead of manually editing queue payloads.
What performance overhead should I expect from BabelQueue JSON envelopes compared with PHP serialize()?
Expect roughly a 10 to 30 percent latency increase from JSON envelope serialization and deserialization compared with PHP serialize(), based on benchmarks for similar packages. Payload size may also grow by about 20 to 40 percent, which can affect broker storage and bandwidth costs. Benchmark your high-throughput queues in staging before migrating everything.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log