LaravelMarch 28, 2026
Events and Listeners in Laravel: Practical Guide
Learn how to use Laravel's event system to build loosely coupled applications.
Laravel’s events provide a simple observer implementation, allowing you to subscribe and listen for various events in your application.
Creating Events
bash
php artisan make:event OrderPlaced
php
class OrderPlaced
{
use Dispatchable, SerializesModels;
public function __construct(
public Order $order
) {}
}
Creating Listeners
bash
php artisan make:listener SendOrderNotification --event=OrderPlaced
php
class SendOrderNotification
{
public function handle(OrderPlaced $event): void
{
$event->order->user->notify(
new OrderConfirmation($event->order)
);
}
}
Dispatching Events
php
// Using the event helper
event(new OrderPlaced($order));
// Using the dispatch method
OrderPlaced::dispatch($order);
Event Discovery
Laravel can automatically discover event listeners:
php
public function shouldDiscoverEvents(): bool
{
return true;
}