tormjens / eventy

WordPress-like actions and filters for Laravel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I do not know what is action and filter in Wordpress

karmendra opened this issue · comments

I have a gut feeling that this tool is something very useful, but I do not know what is action and filter in Wordpress, as I never learnt Wordpress, can someone update the document/readme to give more generic explanation or use case about, how these actions and filters can be used in a Laravel project.

Perhaps it should be noted somewhere that defining hooks is something you'd typically do when creating a Laravel package, while the listeners are typically used in an application to override or extend default behaviour.

I might be biased as I am the one who wrote the documentation, but does it not just explain it just fine? I have added some links in the readme that describe what they are in the WordPress universe, and much would be true for Laravel as well.

If it would help I can add more "real world" examples?

@tormjens I haven't had opportunity to try this package yet, but I think it's awesome. I hope to give it a try and see if I can fit it in the Mastering Laravel package development course I will be launching later this year.

For me the core issue it solves is "how to override/extend default package behavior". Currently, the macro(...) methods and binding overrides in the app / service provider boot methods are my go-to solutions. This Eventy package may become a third.

I understand that Wordpress has been the inspiration for this package, and it should be mentioned as such in the readme.

But the core value it brings to Laravel is imho not "Wordpress power", but package extensibility.

For many Laravel developers, this will probably be easier to relate to.

Yeah, you are probably right. Originally I created this package because I came from the WordPress universe and found Laravel’s eventsystem confusing when starting out. WordPress’ «event» system was just familiar for me, and it made it super-simple to make WordPress behave better.

I’ll try describing it better and that it gives flexibility in applications. I have used it in a modular setup to register modules and run module code anywhere in the existing application.

Thank you for your feedback. I really appreciate it!

@karmendra Please reconsider your thoughts. Wordpress "hooks" system is very poor event system.

@LukaSikic Every architectural decision has its pro's and cons. You're free to not use this package if it doesn't suit your architectural point of view.

I am a bit confused now, are you saying this is replacement for laravel's event listener with different architectural approach?

@karmendra . Given the terms used I understand the confusion. No, it's not a replacement. :)

@sandervanhooft , okay, that said update to document explaining what eventy can do, will help non-wordpress users.