dmstr/symfony-job-queue-bundle
doctrine/dbal + illuminate/database) would be needed, adding complexity./admin/jobs endpoint suggests a monitoring-first design. Laravel’s Horizon or Laravel Nova could serve similar purposes, but this bundle’s structured job entity might offer finer-grained control.Job entity’s schema (status, payload, timestamps) mirrors Laravel’s jobs table structure.Messenger, API Platform) require abstraction layers or replacements (e.g., Laravel’s Bus, Horizon).Job entity’s fields (status, payload, result) map cleanly to Laravel’s failed_jobs table but lack Laravel’s available_at or attempts fields. Custom migrations would be needed.JobMessageHandler pattern could replace Laravel’s ShouldQueue interfaces, but Laravel’s Dispatchable jobs would need refactoring./admin/jobs functionality.serialize()/unserialize(); Laravel’s serialize() may not handle all payloads identically (e.g., closures, resources).pending → running → done|failed) must align with Laravel’s max_attempts and backoff strategies./admin/jobs API add value beyond Laravel’s Horizon or Nova, or is this a "nice-to-have"?failed status?Illuminate\Bus + Illuminate\Queue as a drop-in alternative.Job table mirroring the bundle’s schema./admin/jobs./admin/jobs).Phase 1: Schema Alignment
jobs table in Laravel matching the bundle’s Job entity:
Schema::create('jobs', function (Blueprint $table) {
$table->id();
$table->string('status'); // pending, running, done, failed
$table->text('payload');
$table->text('result')->nullable();
$table->timestamps();
});
status and created_at (critical for querying).Phase 2: Job Dispatch Abstraction
JobQueueService facade wrapping Laravel’s Bus::dispatch():
class JobQueueService {
public function dispatch($job, array $payload) {
$jobEntity = Job::create([
'status' => 'pending',
'payload' => json_encode($payload),
]);
Bus::dispatch($job); // Laravel's Bus
$jobEntity->update(['status' => 'running']);
}
}
HandleJobsMiddleware to update status on job completion/failure.Phase 3: Job Handler Wrapper
JobMessageHandler with a Laravel ShouldQueue trait:
trait HandlesJobQueue {
public function handle() {
try {
$this->performJob();
Job::where('id', $this->jobId)->update(['status' => 'done']);
} catch (\Throwable $e) {
Job::where('id', $this->jobId)->update([
'status' => 'failed',
'result' => $e->getMessage(),
]);
}
}
}
Phase 4: API/Monitoring Layer
/admin/jobs:
Route::get('/admin/jobs', [JobController::class, 'index']);
Phase 5: Testing & Optimization
Job entity must be updated via listeners.ShouldQueue can be migrated incrementally by adding the HandlesJobQueue trait.| Step | Task | Dependencies | Risk |
|---|---|---|---|
| 1 | Schema Migration | - | Low |
| 2 | JobQueueService Facade |
Laravel Bus | Medium |
| 3 | HandlesJobQueue Trait |
Step 2 | Medium |
| 4 | Job Handler Updates | Existing jobs | High (refactoring) |
| 5 | API/Monitoring Layer | Step 3 | Low |
| 6 | Testing & Benchmarking | All | Medium |
Job entity provides a single source of truth for all async jobs, simplifying debugging.pending → running → done|failed states reduce ambiguity in job states.JobQueueService and HandlesJobQueue trait require updates if Laravel’s queue system evolves./admin/jobs endpoint must be kept in sync with Laravel’s auth/validation layers.jobs table can filter by status/timestamps (e.g., SELECT * FROM jobs WHERE status = 'failed' AND created_at > NOW() - INTERVAL 1 DAY).Job entity’s data.How can I help you explore Laravel packages today?