# Laravel Background Processing

> Scalable asynchronous workflows using Queues, Jobs, and Events.

- Skill: `mte90/laravel-background-processing` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add mte90/laravel-background-processing`
- Raw SKILL.md: https://api.skillmd.com/api/skills/mte90/laravel-background-processing/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: mte90 (https://skillmd.com/u/mte90)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/mte90/laravel-background-processing

---


# Laravel Background Processing

## **Priority: P1 (HIGH)**

## Structure

```text
app/
├── Jobs/               # Asynchronous tasks
├── Events/             # Communication flags
└── Listeners/          # Task reactions
```

## Implementation Guidelines

- **Offload Heavy Tasks**: Move any logic taking >100ms to a Queued Job.
- **ShouldQueue Interface**: Add to Listeners for transparent async execution.
- **Redis Driver**: Use Redis for reliable and high-throughput queuing.
- **Job Chaining**: Use `Bus::chain()` for dependent sequential jobs.
- **Job Batching**: Use `Bus::batch()` for parallel task monitoring.
- **Failures**: Define `failed()` method in jobs to handle permanent errors.
- **Monitoring**: Use **Laravel Horizon** for real-time queue observability.

## Anti-Patterns

- **Blocking UX**: **No heavy logic in Request path**: Always defer to Queues.
- **Raw Models**: **No large job payloads**: Pass model IDs, not full objects.
- **Implicit Flow**: **No deep event-loop logic**: Keep listener chains shallow.
- **Silent Failures**: **No unmonitored queues**: Ensure retries and alerts.

## References

- [Job Chaining & Event Patterns](references/implementation.md)

