Introduction

Laravel is undoubtedly a very powerful framework with a lot of batteries included. One of the reasons I love laravel is the fact that it is built on events.

What are Laravel Events?

An event is an action or occurrence recognized by a program that may be handled by the program. Some examples of events in Laravel would be:

A new user has signed up A comment was posted A user creates a blog post A user likes a photo Much moreā€¦

Why Use Events?

The reason we use events is because they allow us to separate application concerns and creates a mechanism for us to hook into actions in our application. When an event is fired, the event does not need to know anything about its implementation, all the event needs to know is that an action is performed, the event is triggered, the event sends some data to a listener or subscriber somewhere that has to deal with it.