Field Manual PHP / Laravel reference
← Laravel

Queues

Queues run deferred work outside the request.

What it is

Queues run deferred work outside the request.

When to use it

Use for slow work only when operational complexity is justified.

Syntax

SendReceipt::dispatch($order->id)->afterCommit();

Example

// With a configured database queue and worker:
php artisan queue:work
// A job should be retry-safe and reference persisted IDs.
// Dispatch after commit so the worker cannot observe uncommitted data.

Common mistakes

No worker means no processing; retries can repeat effects; a synchronous driver offers no asynchronous execution.

Related topics

Browse Laravel