Proposal: Attribute-Based Event Subscription #56884
Unanswered
ahmedsayedabdelsalam
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Proposal: Attribute-Based Event Subscription in Laravel
Motivation
Laravel currently supports two main ways to handle events:
EventServiceProvider::$listen
Subscriber classes with subscribe()
Example today:
Proposal: Attribute-Based Subscription
Introduce a #[Subscribe] attribute that can be applied directly to methods in subscriber classes.
Benefits
Less boilerplate → no need for subscribe() methods.
Cleaner intent → event handlers are self-documented at the method level.
Beta Was this translation helpful? Give feedback.
All reactions