PHPackages                             react/event-loop - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. react/event-loop

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

react/event-loop
================

ReactPHP's core reactor event loop that libraries can use for evented I/O.

v1.6.0(6mo ago)1.3k139.6M—3.7%131[2 issues](https://github.com/reactphp/event-loop/issues)[3 PRs](https://github.com/reactphp/event-loop/pulls)20MITPHPPHP &gt;=5.3.0CI passing

Since Jul 11Pushed 1w ago47 watchersCompare

[ Source](https://github.com/reactphp/event-loop)[ Packagist](https://packagist.org/packages/react/event-loop)[ Fund](https://opencollective.com/reactphp)[ RSS](/packages/react-event-loop/feed)WikiDiscussions 3.x Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (28)Used By (20)

EventLoop
=========

[](#eventloop)

[![CI status](https://github.com/reactphp/event-loop/actions/workflows/ci.yml/badge.svg)](https://github.com/reactphp/event-loop/actions)[![installs on Packagist](https://camo.githubusercontent.com/180bacd1b1cc88e01b3abca3667933a7735a989c17805c54b5b0f75faa47b879/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72656163742f6576656e742d6c6f6f703f636f6c6f723d626c7565266c6162656c3d696e7374616c6c732532306f6e2532305061636b6167697374)](https://packagist.org/packages/react/event-loop)

[ReactPHP](https://reactphp.org/)'s core reactor event loop that libraries can use for evented I/O.

> **Development version:** This branch contains the code for the upcoming v3 release. For the code of the current stable v1 release, check out the [`1.x` branch](https://github.com/reactphp/event-loop/tree/1.x).
>
> The upcoming v3 release will be the way forward for this package. However, we will still actively support v1 for those not yet on the latest version. See also [installation instructions](#install) for more details.

In order for async based libraries to be interoperable, they need to use the same event loop. This component provides a common `LoopInterface` that any library can target. This allows them to be used in the same loop, with one single [`run()`](#run) call that is controlled by the user.

**Table of contents**

- [Quickstart example](#quickstart-example)
- [Usage](#usage)
    - [Loop](#loop)
        - [Loop methods](#loop-methods)
        - [Loop autorun](#loop-autorun)
        - [get()](#get)
    - [Loop implementations](#loop-implementations)
        - [StreamSelectLoop](#streamselectloop)
        - [ExtEventLoop](#exteventloop)
        - [ExtEvLoop](#extevloop)
        - [ExtUvLoop](#extuvloop)
    - [LoopInterface](#loopinterface)
        - [run()](#run)
        - [stop()](#stop)
        - [addTimer()](#addtimer)
        - [addPeriodicTimer()](#addperiodictimer)
        - [cancelTimer()](#canceltimer)
        - [futureTick()](#futuretick)
        - [addSignal()](#addsignal)
        - [removeSignal()](#removesignal)
        - [addReadStream()](#addreadstream)
        - [addWriteStream()](#addwritestream)
        - [removeReadStream()](#removereadstream)
        - [removeWriteStream()](#removewritestream)
- [Install](#install)
- [Tests](#tests)
- [License](#license)
- [More](#more)

Quickstart example
------------------

[](#quickstart-example)

Here is an async HTTP server built with just the event loop.

```
