@michael@thms.uk
@michael@thms.uk avatar

michael

@michael@thms.uk

Full stack web developer currently working mostly with #PHP / #Laravel, Vanilla #Javascript and #SCSS. Love learning more about (almost) anything, but particularly #MySQL and #InfoSec. Currently learning Arabic. Husband, father of two boys, Christian.

This profile is from a federated server and may be incomplete. Browse more on the original instance.

michael, to Laravel
@michael@thms.uk avatar

So, it really annoyed me that in Laravel 11 you cannot have multiple listeners for the same event in an array like you could in Laravel 10.

It's not like it's a big deal, as it's simple enough to implement, but just seems like a step backwards.

What do you think?

https://blog.thms.uk/2024/05/event-listeners-laravel-11?utm_source=mastodon

#Laravel #PHP

michael,
@michael@thms.uk avatar

@stefanzweifel yeah, not a big fan of auto discovery either.

It just makes events way too opaque, in my opinion.

michael,
@michael@thms.uk avatar

@stefanzweifel yep. Had exactly the same issue …

michael,
@michael@thms.uk avatar

@outofcontrol it does require further optimisation at deploy time, if that’s what you mean.

That is part of artisan optimize though, so if you are already using that you don’t need to do anything else.
@stefanzweifel

emd, to Laravel
@emd@cosocial.ca avatar

What am I missing folks, you can't have multiple listeners (in an array) in v11?

https://laracasts.com/discuss/channels/laravel/laravel-11-register-event-with-multiple-listeners

michael,
@michael@thms.uk avatar

@emd yeah, I was looking at that earlier this week and thinking that’s a massive step backwards.

michael,
@michael@thms.uk avatar

@emd quite. I think autodiscovery for events isn’t great either to be honest.

Events already run the risk of stuff happening in opaque ways. This is gonna be even worse now.

michael,
@michael@thms.uk avatar

@emd I've just created this function in my AppServiceProvider. A bit silly that I now need to do this manually, imo, but not a big deal I suppose 🤷‍♂️

  • All
  • Subscribed
  • Moderated
  • Favorites
  • JUstTest
  • thenastyranch
  • DreamBathrooms
  • InstantRegret
  • magazineikmin
  • osvaldo12
  • Youngstown
  • tacticalgear
  • GTA5RPClips
  • slotface
  • rosin
  • Leos
  • kavyap
  • everett
  • normalnudes
  • khanakhh
  • mdbf
  • Durango
  • ethstaker
  • modclub
  • ngwrru68w68
  • anitta
  • tester
  • cisconetworking
  • cubers
  • megavids
  • provamag3
  • lostlight
  • All magazines