enqueue/simple-client
Enqueue Simple Client combines Enqueue client classes with Symfony components into an easy-to-use SimpleClient facade for sending and consuming messages via queues. Part of the Enqueue ecosystem; see docs and support via the project site.
SimpleClient abstracts Enqueue’s complexity but adds a thin layer of indirection. For Laravel, this is beneficial as it aligns with the framework’s philosophy of simplicity while unlocking advanced queue features (e.g., multi-transport support, priority queues). The facade pattern reduces boilerplate for common operations (e.g., connection management, message serialization), making it ideal for teams prioritizing developer velocity.SimpleClient can act as a bridge between Laravel’s Illuminate\Queue and Enqueue’s transport-agnostic abstractions, allowing teams to swap brokers without refactoring job logic.Config and YAML components, which are already integrated into Laravel (via symfony/console, symfony/finder, etc.). This reduces friction for teams familiar with Symfony’s ecosystem and enables shared configurations across Laravel and Symfony microservices.Illuminate\Events) and notifications (Illuminate\Notifications) by providing a robust foundation for asynchronous workflows. For example, failed notifications can be retried via Enqueue’s retry mechanisms, while successful ones can trigger downstream jobs.SimpleClient can be seamlessly integrated into Laravel’s queue system by registering it as a custom driver. This allows existing Laravel jobs to leverage Enqueue’s features without modifying job classes. The integration path is well-documented in the Enqueue Laravel bridge, which provides a QueueServiceProvider and EnqueueConnection to handle driver registration.SimpleClient supports Enqueue’s Message class, which can serialize Laravel jobs via serialize()/unserialize() or JSON. This may require custom serializers for complex job payloads (e.g., closures, resources).queue:work with Enqueue’s enqueue:consume, which offers advanced features like:
enqueue/enqueue (v0.10+) and queue-interop (v1.0+), which may introduce conflicts with Laravel’s dependencies or require pinning versions. For example:
symfony/config (used by Enqueue) may conflict with Laravel’s symfony/console or symfony/dependency-injection.php-amqplib (AMQP transport) may have compatibility issues with older PHP versions or non-standard AMQP brokers.php-compat).enqueue/statsd).SimpleClient justified?spatie/laravel-queue-scheduler) that provide similar functionality with lower complexity?SimpleClient facade compared to direct broker interactions (e.g., php-amqplib)? Are there benchmarks for Laravel-specific workloads?monolog) or error tracking (e.g., Sentry)?SimpleClient and Laravel (e.g., updates to the Enqueue Laravel bridge, dependency upgrades)?.env or vault-based secrets management?php-amqplib, symfony/config) that could affect the application?SimpleClient as a custom queue driver in config/queue.php:
'connections' => [
'enqueue' => [
'driver' => 'enqueue',
'client' => \Enqueue\Client\SimpleClient::class,
'config' => [
'dsn' => env('QUEUE_CONNECTION_DSN', 'amqp://guest:guest@localhost:5672/%2f'),
'transport' => env('QUEUE_TRANSPORT', 'amqp'), // 'amqp', 'redis', 'fs', etc.
],
],
],
enqueue driver in job dispatching:
dispatch(new ProcessOrder($order))->onQueue('enqueue');
Messenger component (e.g., in a Laravel microservice), the SimpleClient can act as a transport bridge:
$transport = new \Enqueue\Symfony\Transport\SymfonyTransport(
new SimpleClient(),
'amqp://user:pass@localhost:5672/%2f'
);
$bus = new \Symfony\Component\Messenger\MessageBus([
new \Symfony\Component\Messenger\Handler\HandlersLocator([...]),
new \Symfony\Component\Messenger\Transport\Serialization\Serializer(),
]);
QueueServiceProvider to bind the SimpleClient and its dependencies:
public function register()
{
$this->app->singleton(\Enqueue\Client\SimpleClient::class, function ($app) {
$config = $app['config']['queue.connections.enqueue'];
return new SimpleClient($config['dsn'], $config['transport'] ?? 'amqp');
});
}
Message class:
use Enqueue\Client\Message;
class LaravelJobSerializer implements \Enqueue\Client\Serializer
{
public function serialize($data): string
{
return serialize($data);
}
public function deserialize(string $data): array
{
return unserialize($data);
}
}
Phase 1: Pilot with Non-Critical Jobs
enqueue driver.queue:failed-table and Enqueue’s enqueue:failed to monitor failures.Phase 2: Incremental Driver Adoption
How can I help you explore Laravel packages today?