enqueue/pheanstalk
Enqueue Beanstalk Transport integrates Beanstalkd with the Enqueue queue specification, letting you send and consume messages via the Pheanstalk client. Includes docs, CI, and Packagist distribution for PHP apps and workers.
enqueue/pheanstalk package leverages the Queue Interop standard, making it a seamless fit for Laravel applications requiring asynchronous job processing or event-driven architectures. It extends Laravel’s queue ecosystem beyond Redis/SQS/database to include Beanstalkd, a lightweight, high-performance message broker ideal for:
Illuminate\Queue) supports Redis, database, and SQS, this package enables Beanstalkd integration without reinventing the wheel. The Enqueue library’s abstraction layer ensures compatibility with Laravel’s ShouldQueue jobs, provided a serialization bridge is implemented.enqueue/laravel package (if available) to bridge Laravel’s Queue facade to Enqueue’s Beanstalkd transport.Illuminate\Queue\QueueManager to register enqueue/pheanstalk as a driver.enqueue/serializer package or a custom adapter (e.g., JSON, PHP serialize()) is needed.pda/pheanstalk), including host, port, and timeouts. Laravel’s queue.php config must be extended to support this.'connections' => [
'beanstalkd' => [
'driver' => 'enqueue',
'transport' => 'pheanstalk',
'dsn' => 'pheanstalk://user:pass@beanstalkd:11300',
],
],
queue:work command may need replacement with Enqueue’s enqueue:consume for full feature parity (e.g., retry logic, dead-letter queues).| Risk Area | Impact | Mitigation Strategy |
|---|---|---|
| Laravel Integration Gaps | High | Develop a custom queue connector or adopt enqueue/laravel if available. |
| Serialization Failures | Medium | Use enqueue/serializer or implement a fallback serializer for Laravel jobs. |
| Beanstalkd Dependency | High (Operational) | Ensure high availability (managed service or clustering) and monitoring. |
| Performance Overhead | Medium | Benchmark against Laravel’s native drivers (Redis, database) for latency/throughput. |
| Error Handling | Medium | Extend Laravel’s queue listeners to handle Beanstalkd-specific errors (e.g., timeouts). |
| Job Retry Logic | Medium | Leverage Enqueue’s retry middleware or implement custom retry logic in workers. |
enqueue/laravel package available, or must a custom bridge be built?ShouldQueue jobs (e.g., closures, resources) be serialized/deserialized?php artisan queue:work) be adapted?Illuminate\Queue facade, extended to support Enqueue’s Beanstalkd transport.beanstalkd-stats, Prometheus exporters).composer require enqueue/pheanstalk pda/pheanstalk enqueue/serializer
queue.php to use the Beanstalkd transport:
'connections' => [
'beanstalkd' => [
'driver' => 'enqueue',
'transport' => 'pheanstalk',
'dsn' => env('BEANSTALKD_DSN', 'pheanstalk://localhost:11300'),
'options' => [
'timeout' => 5.0,
'read_write_timeout' => 2.0,
],
],
],
enqueue/laravel (if available) for seamless integration.// app/Providers/QueueServiceProvider.php
public function register()
{
Queue::extend('enqueue', function ($app) {
return new EnqueueQueueService(
new PheanstalkContext(env('BEANSTALKD_DSN'))
);
});
}
// app/Providers/AppServiceProvider.php
public function boot()
{
$serializer = new JsonSerializer();
Enqueue::setSerializer($serializer);
}
class SendEmailJob implements ShouldQueue
{
public function handle() { /* ... */ }
}
queue:work with Enqueue’s consumer:
php artisan enqueue:consume beanstalkd --memory=512M
| Component | Compatibility Notes |
|---|---|
| Laravel Version | Tested with Laravel 9/10; requires PHP 8.1+. |
| Enqueue Version | Must align with enqueue/pheanstalk’s dependencies (e.g., queue-interop/queue-interop). |
| Beanstalkd Version | Compatible with Pheanstalk 3.1+; server version should match client requirements. |
| Laravel Jobs | Custom serialization may be needed for complex payloads (e.g., closures, resources). |
| Existing Workers | `queue: |
How can I help you explore Laravel packages today?