mcpField
L
laravel-jobs

laravel-jobs

github.com/leeoveryDevelopment1551 installsUpdated 2w ago
Repository

About laravel-jobs

laravel-jobs is a skill for Laravel developers that describes background job and event-listener patterns. It emphasizes keeping jobs as thin delegation layers, with domain logic in actions.

Key features

  1. 01Delegate jobs to actions
  2. 02Configure queues, retries, and timeouts
  3. 03Define unique jobs and job middleware
  4. 04Structure event listeners
  5. 05Choose between jobs and synchronous actions

Use cases

  1. 01Move background processing into delegated actions
  2. 02Set retry and timeout behavior for queued jobs
  3. 03Prevent duplicate execution with unique jobs
  4. 04Choose a job or synchronous action for a task

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/leeovery/agentic-skills --skill laravel-jobs

After installing, type/laravel-jobsin Claude Code to confirm it loaded.

Bundled filesreferences/jobs-listeners.md

Details

From the project README

Laravel Jobs

Background jobs and event listeners: thin delegation layers to actions.

Core Concept

jobs-listeners.md - Job patterns:

  • Jobs as thin delegation layers
  • Queue configuration
  • Retry logic and timeouts
  • Unique jobs
  • Job middleware
  • Event listeners
  • When to use jobs vs sync actions

Pattern

final class ProcessOrderJob implements ShouldQueue
{
    use Dispatchable, Queueable;

    public function __construct(
        public readonly int $orderId,
    ) {}

    public function handle(ProcessOrderAction $action): void
    {
        $order = Order::findOrFail($this->orderId);

        $action($order);
    }

    public function middleware(): array
    {
        return [new WithoutOverlapping($this->orderId)];
    }
}

// Listener
final class SendOrderConfirmationListener
{
    public function handle(OrderPlaced $event): void
    {
        SendOrderConfirmationJob::dispatch($event->order->id);
    }
}

Jobs delegate to actions. Keep domain logic in actions, not jobs.

Comments

Markdown supported