How do I add a custom event to a Service Provider?

Laravel events provide an observer implementation, allowing you to listen and observe for specific tasks happening in your application. Adding a custom event to a ServiceProvidermeans that the application will listen to it as soon as it occurs. In terms of choosing the right ServiceProviderfor the job, it breaks down into two options: a Module ServiceProvider, or any of the Providers listed under app/Providersof our shop’s root directory.

Event directory:

app/Events

Listener directory:

app/Listeners

The ServiceProviderclass has a $listenproperty, to which we simply add on the Event that we wish to add, alongside its listener.


Revision #1
Created 2026-09-02 13:27:50 UTC by Michael Price
Updated 2026-09-02 13:27:50 UTC by Michael Price