Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

tempura's avatar

Using Laravel Events

Ok, so this one is going to be a general question.

I currently have small free time and I would like to utilize all what I can do with Laravel. I would like to use Events and make sure I'm not abusing it. I'm planning to use it on every after... events; events like After logging in, logging out, inserted new product, added/subtracted stocks then record the transaction, uploaded something then record the date, etc.

I would like to do use it that way, use it on every after an event has happened. If I'll be doing the stuffs coming without knowing about Laravel events, I'll just simply add it at the end of each methods, or call another method at the end of those methods instead of adding it directly on the same method.

Am I still on the right track? I would like to step out a bit of my usual ways and do different stuffs and learn something new, because after all, that's one of the reasons we use "frameworks" such as Laravel right?

Again, am I still on the right track here? Or should I do it on how I'll be doing it normally without this "event" feature?

0 likes
4 replies
InaniELHoussain's avatar

I guess, it depends, I mean there is no rule that will tight you or let you free. you shouldn't over use it, there are case where its just FINE to use it, for instance sending mails. Actually as I said its just you at a certain moment will consider using it or not.

d3xt3r's avatar
d3xt3r
Best Answer
Level 29

Or should I do it on how I'll be doing it normally without this "event" feature?

These so called features are for convenience , code separation and separation of other concerns.

Without them, each of your method call would have to know, what happens next. But with this particular feature, it just needs to raise the event and your framework (listeners) are then solely responsible for taking any (appropriate) action.

So if an event can NEVER be thrown(raised) by another method you can have the after logic at the same place, else, use 'eventsandlisteners` to keep it simple...

1 like
tempura's avatar

convenience

Very convincing. Sweet, I can now say that I'm still on the right track about me using this events. Thanks :) Inputs are still welcome, I'll accept your answer @d3xt3r once there are no more replies.

Please or to participate in this conversation.