Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Event Loop Laravel Package

revolt/event-loop

Revolt is a rock-solid event loop for PHP 8.1+ that enables cooperative multitasking with fibers and non-blocking I/O while keeping code synchronous. A lightweight scheduler foundation for concurrent apps and libraries like Amp and ReactPHP.

View on GitHub
Deep Wiki
Context7

Revolt is a rock-solid event loop for concurrent PHP applications.

Frequently asked questions about Event Loop
Can I use Revolt’s event loop to replace Laravel Queues for background jobs?
Yes, Revolt’s fiber-based event loop can power async job processing in Laravel by integrating with Revolt’s async package or custom workers. It avoids blocking the request thread while maintaining synchronous-like code. However, you’ll need to wrap Laravel’s job payloads in fiber-compatible handlers and manage worker pools separately from the web server.
How does Revolt handle WebSocket connections in a Laravel app?
Revolt’s HTTP server extension can handle WebSocket connections alongside Laravel’s HTTP layer, but they must run in separate processes (e.g., via Laravel Forge or Docker). Use Revolt’s `revolt/http` for WebSocket endpoints while keeping Laravel’s routes for traditional HTTP. Middleware and authentication must be manually bridged between the two systems.
Will Revolt work with PHP 8.0 or older versions?
No, Revolt requires PHP 8.1+ due to its reliance on fibers. This is a deliberate design choice to ensure stability and leverage modern PHP features. If you’re stuck on PHP 7.x or 8.0, consider alternatives like ReactPHP or Amp, though they use callbacks/promises instead of fibers.
How do I integrate Revolt with Laravel’s Eloquent ORM?
Eloquent isn’t fiber-aware by default, so you’ll need a fiber-compatible PDO driver like `revolt/ext-pdo` to avoid blocking the event loop during database queries. Wrap Eloquent calls in fibers and ensure transactions or retries are handled explicitly. Test thoroughly, as some PDO behaviors (e.g., persistent connections) may need adjustments.
What’s the performance impact of using Revolt in Laravel?
Revolt adds minimal overhead for I/O-bound tasks (e.g., API calls, WebSockets) compared to synchronous PHP, but fiber management introduces slight memory and CPU costs. Benchmark your specific workload—Revolt shines with high concurrency (e.g., 1,000+ WebSocket connections) but may not justify the complexity for low-concurrency apps. Profile with tools like Blackfire to compare against synchronous or ReactPHP-based solutions.
How do I debug fiber-related issues in Laravel?
Use Xdebug with `xdebug.mode=debug` and configure it to trace fiber suspensions via `xdebug.trace_format=0`. Revolt’s `FiberLocal` can complicate stack traces, so log fiber IDs (`Fiber::getCurrent()->getId()`) in errors. Avoid global state in fibers, and use `revolt/event-loop`'s `UnhandledThrowable` to catch uncaught exceptions without crashing the loop.
Can Revolt replace Laravel’s request handling (e.g., middleware, routes)?
No, Revolt isn’t designed to replace Laravel’s synchronous request pipeline. However, you can offload blocking operations (e.g., external API calls) to fibers using middleware like `SuspendMiddleware` from `revolt/http`. For full async routing, consider running Revolt’s HTTP server as a reverse proxy (e.g., via Nginx) alongside Laravel.
What are the alternatives to Revolt for async PHP in Laravel?
For PHP 8.1+, Revolt is the most modern choice due to its fiber-based simplicity. Alternatives include ReactPHP (callback-based, works on older PHP) or Amp (promise-based, also fiber-compatible). Swoole offers threads but is heavier and less portable. If you need minimal changes, stick with Laravel’s synchronous stack or use queues for async tasks.
How do I scale Revolt for high-concurrency use cases (e.g., 10,000+ WebSocket connections)?
Use Revolt’s extensions (e.g., `revolt/ext-sockets`) for high file descriptor counts and distribute load across multiple PHP processes/workers. Monitor fiber leaks with `Fiber::getCurrent()->isSuspended()` checks and set up a connection pooler like `revolt/pool`. For Laravel, isolate Revolt’s event loop in a separate service (e.g., via Docker or a microservice).
Is Revolt maintained actively, and how can I contribute?
Revolt is actively maintained by the RevoltPHP team, with regular updates for PHP versions and bug fixes. Contributions are welcome via GitHub issues/PRs—focus on fiber stability, extension compatibility, and Laravel-specific integrations. Check the [Revolt documentation](https://revolt.run/) for contribution guidelines. The project follows SemVer, so breaking changes are rare but documented.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
ecotone/kafka
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata