dmank/gearman
PHP library to work with Gearman clients and workers. Supports multiple servers via a ServerCollection, running jobs synchronously or in background, retrieving job status via job handles, and worker lifecycle control through eventing (e.g., memory/time limits).
ext-gearman required).ServerCollection), improving reliability.Illuminate\Queue). Custom glue code required.php-ffmpeg/ffmpeg-php for media tasks, or Laravel’s queue:work with Redis).queue:work instead).executeInBackground for async tasks and validate job completion via JobHandle.Illuminate\Queue\Queue to wrap dmank/gearman.// app/Providers/QueueServiceProvider.php
Queue::extend('gearman', function ($app) {
return new GearmanQueue(new \dmank\gearman\Client($serverCollection));
});
$worker = new \dmank\gearman\Worker();
$worker->addFunction('process_image', function ($job) {
// Handle job
});
$worker->run();
pecl/gearman installed on both Laravel servers and workers.pecl install gearman with --force).create_function).gearmand).dmank/gearman to composer.json with @stable (or fork if PHP 8.x is critical).pecl/gearman or PHP.pda/pheanstalk for Beanstalkd).gearmanadmin or custom logging are essential.retry-after).--max-jobs or custom logic).gearmanadmin --stats for stalled jobs.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Gearman server crash | Jobs fail silently | Multi-server ServerCollection + health checks |
| PHP worker crashes | Unprocessed jobs | Supervisor/Process Manager (e.g., PM2) |
| Network partition | Timeouts or job loss | Retry logic + persistent job storage (DB) |
| PHP 8.x incompatibility | Package breaks | Fork or switch to maintained alternative |
| Laravel app restart | In-flight jobs lost | Use Laravel’s queue system for critical jobs |
executeInBackground vs. executeJob).gearmanadmin, custom logs).--workers=N) and timeouts.How can I help you explore Laravel packages today?