Skip to content

Conversation

@robertogallea
Copy link

Summary
This PR introduces the ability to execute Event Listeners using PHP Fibers. This enhancement can significantly improve performance, especially when the sync driver is used for event dispatching.

How it works
To leverage this feature, a Listener class simply needs to include the RunsOnFiber trait—no additional setup required. The event dispatcher automatically detects listeners using this trait and executes their handling logic inside a Fiber. The RunsOnFiber trait provides a built-in decorator to handle the execution seamlessly.

This approach ensures a lightweight integration of Fibers, offering better responsiveness and concurrency for event-driven workflows.

@robertogallea robertogallea changed the title Execute event listener using Fiber [11.x] Execute event listener using Fiber Nov 27, 2024
@taylorotwell
Copy link
Member

Please provide before and after benchmarks in a real world scenario. 👍 Thanks!

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.

2 participants