revolt/event-loop-adapter-react
Run ReactPHP libraries on the Revolt event loop. This adapter lets you pass React\EventLoop\Loop::get() where a LoopInterface is required, automatically bridging ReactPHP components to Revolt for a single, unified loop.
Install the package with composer require revolt/event-loop-adapter-react. This adapter bridges ReactPHP’s LoopInterface to Revolt’s event loop—no code changes required beyond replacing React\EventLoop\LoopFactory::create() with Revolt\EventLoop\Loop::get(). Start by building a minimal ReactPHP-based server (e.g., HTTP or socket) using Loop::get() as the loop instance, then invoke Revolt\EventLoop::run() to start execution. The README’s HTTP server snippet is the canonical reference—copy, tweak the app logic, and run.
react/http, react/socket, react/dns), pass Revolt\EventLoop\Loop::get() wherever LoopInterface is expected.Revolt\EventLoop::run() to start the event loop—never React\EventLoop\Loop::run(), to ensure all hooks delegate to Revolt.EventLoop::run().Loop::get() returns a persistent singleton—do not mix it with React\EventLoop\LoopFactory::create(), or you risk duplicate loop instances and erratic behavior.SIGTERM) to ReactPHP handlers; pin to ^1.1.1 if signalGracefulShutdown is needed.Loop::enable() or similar—this adapter auto-wires React’s hooks into Revolt on first use.EventLoop::run() is called after all subscriptions, and inspect for uncaught exceptions in deferred stacks (Revolt’s loop throws stricter timing errors).react/event-loop and revolt/event-loop, you never instantiate React’s loop directly—the adapter only works via Loop::get().How can I help you explore Laravel packages today?