Queues: Running Jobs in the Background
Improve performance by processing time-consuming tasks in the background using queues.
Amanda Clark
October 16, 2025
5.2k199
Some tasks take time, such as sending emails or generating reports. Queues allow these to run in the background.
## Create a job
```bash
php artisan make:job SendInvoiceEmail
```
## Job handle method
```php
public function handle() {
Mail::to($this->user)->send(new InvoiceMail($this->invoice));
}
```
## Dispatch job
```php
SendInvoiceEmail::dispatch($user, $invoice);
```
## Queue flow
```mermaid
flowchart LR
A[Request] --> B[Dispatch Job]
B --> C[(Queue)]
D[Worker] --> C
D --> E[Process Job]
```
Queues keep your app fast and responsive.
In the next tutorial, we will schedule recurring tasks.
#Laravel#Queues#Advanced