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 concurrent PHP 8.1+ apps using fibers. It enables non-blocking I/O with synchronous code, serving as a minimal, shared scheduler base for libraries like Amp and ReactPHP.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Concurrency in PHP Applications: Enables non-blocking I/O for high-performance applications (e.g., real-time APIs, WebSocket servers, or event-driven microservices) without rewriting legacy synchronous code.
  • Fiber-Based Architecture: Leverages PHP 8.1+ fibers for cooperative multitasking, reducing complexity compared to callback-based alternatives (e.g., ReactPHP/Amp).
  • Build vs. Buy: Buy for core event-loop functionality (avoids reinventing the wheel) while building higher-level abstractions (e.g., HTTP servers, task queues) on top.
  • Roadmap Priorities:
    • Real-time systems: Chat apps, live dashboards, or IoT data pipelines.
    • Scalability: Replace synchronous bottlenecks (e.g., database polling, HTTP clients) with async alternatives.
    • Legacy modernization: Gradually introduce concurrency to monolithic PHP apps without full rewrite.
  • Use Cases:
    • API Gateways: Handle thousands of concurrent requests with low latency.
    • WebSockets: Scale real-time features (e.g., notifications, collaborative tools).
    • Background Jobs: Process tasks asynchronously (e.g., image resizing, report generation).
    • Hybrid Architectures: Combine synchronous and async code paths (e.g., Laravel + async workers).

When to Consider This Package

  • Adopt if:

    • Your app requires high concurrency (e.g., >10K concurrent connections) or low-latency responses.
    • You’re using PHP 8.1+ and want to leverage fibers without callback hell.
    • You need a lightweight, framework-agnostic event loop (not a full framework like Swoole).
    • Your team prefers synchronous-like syntax (e.g., yield/await-style code) over Promises/callbacks.
    • You’re building real-time systems (e.g., WebSockets, pub/sub) or microservices with async I/O.
  • Look elsewhere if:

    • You need full-stack async PHP (consider Swoole or RoadRunner).
    • Your app is simple (e.g., CRUD APIs with no concurrency needs).
    • You’re locked into PHP <8.1 (fibers are required).
    • You prefer Promises/callbacks over fibers (use ReactPHP or Amp).
    • You need built-in HTTP/WebSocket servers (Revolt is a low-level loop; pair with Revolt HTTP or Workerman).

How to Pitch It (Stakeholders)

For Executives:

*"Revolt is a high-performance event loop that lets us handle 10x more concurrent users in PHP without rewriting our entire stack. By leveraging PHP 8.1’s native fibers, we avoid the complexity of callbacks or coroutines while keeping code familiar. This directly enables:

  • Faster APIs (e.g., real-time analytics, WebSocket dashboards).
  • Lower cloud costs (fewer servers for the same load).
  • Future-proofing our tech stack as we scale. Think of it as Node.js’s event-loop for PHP—but built for PHP’s strengths. We’re not betting on a framework; we’re future-proofing our concurrency layer."*

For Engineers:

*"Revolt gives us a rock-solid event loop for PHP 8.1+ that:

  • Works with fibers: Write async code that looks synchronous (e.g., yield instead of Promises).
  • Integrates with existing PHP: No need to rewrite everything—wrap blocking calls in suspensions.
  • Supports high concurrency: Handles thousands of I/O-bound tasks (e.g., DB queries, HTTP calls) without blocking.
  • Is lightweight: Just the loop—we can build higher-level tools (e.g., HTTP servers, job queues) on top. Key tradeoffs:
  • Requires PHP 8.1+ (fibers).
  • Not a full framework (pair with Revolt HTTP or your own abstractions).
  • Debugging fibers can be tricky (but tools like Xdebug improve this). Use it for:
  • Real-time APIs (WebSockets, SSE).
  • Async task queues (e.g., image processing, reports).
  • Replacing sleep()/file_get_contents() bottlenecks. Avoid for:
  • CPU-bound work (use Swoole or workers).
  • Simple scripts with no concurrency needs."*

For Architects:

*"Revolt’s event loop is a strategic foundation for:

  1. Decoupling I/O-bound work: Isolate blocking calls (e.g., DB, HTTP) into async fibers.
  2. Enabling hybrid architectures: Mix sync (e.g., Laravel) and async (e.g., WebSockets) code paths.
  3. Scaling horizontally: Reduce per-request latency, allowing fewer servers for the same load. Integration notes:
  • Pair with: Revolt HTTP (for servers), Doctrine DBAL (for async queries), or custom suspensions.
  • Avoid mixing: Don’t use with ReactPHP/Amp (they’re alternatives).
  • Monitor: Fiber leaks (ensure suspensions are resumed) and event-loop health (e.g., EventLoop::isEnabled()). Migration path:
  • Start with non-critical async paths (e.g., background jobs).
  • Gradually replace blocking calls (e.g., file_get_contents()Revolt\EventLoop\Suspension)."*
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.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope