Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to listen to League events via Symfony listeners/subscribers #65

Conversation

X-Coder264
Copy link
Contributor

This is a very simple approach to emit League OAuth server events via the Symfony event dispatcher so that users can create their own listeners in their Symfony applications.

Closes #35

@ajgarlag
Copy link
Contributor

@X-Coder264 Instead of coding a partial implementation of EmitterInterface we can use a League event listener to forward league events to Symfony event dispatcher. Please, see X-Coder264#1

@X-Coder264
Copy link
Contributor Author

@ajgarlag Thanks, I didn't know about the existence of ListenerProviderInterface interface. I still think this approach is better, because even though the emitter interface is bloated so you save a couple of lines with your approach, this approach ensures that all events emitted by the server will be dispatched via the Symfony dispatcher. Your approach has only some events hardcoded, which doesn't take into consideration events that can be emitted in custom grants or events that the League Server package could add in a future release (which we'd then have to manually add to that allow list afterwards in order to make them usable to the users of this bundle).

@ajgarlag
Copy link
Contributor

@X-Coder264 I've seen that league\event supports Wilcard Listeners

@X-Coder264
Copy link
Contributor Author

I was just looking into committing that * solution, you beat me to it 😛

Copy link
Member

@chalasr chalasr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great. One minor comment, thanks!

docs/listening-to-league-events.md Outdated Show resolved Hide resolved
@chalasr chalasr force-pushed the emit-events-via-symfony-event-dispatcher branch from ac1b535 to cf5b9fc Compare December 4, 2021 17:20
@chalasr
Copy link
Member

chalasr commented Dec 4, 2021

Thank you @X-Coder264.

@chalasr chalasr merged commit b8c2b16 into thephpleague:master Dec 4, 2021
@X-Coder264 X-Coder264 deleted the emit-events-via-symfony-event-dispatcher branch December 4, 2021 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

delegate league events to symfony
4 participants