Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Nuclear Reactor written in PHP.
branch: dns

This branch is 577 commits behind reactphp:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
examples
resources
scripts
src/React
tests
.gitignore
.travis.yml
CHANGELOG.md
LICENSE
README.md
composer.json
composer.lock
phpunit.xml.dist

README.md

React

Event-driven, non-blocking I/O with PHP.

Build Status

Install

The recommended way to install react is through composer.

{
    "require": {
        "react/react": "0.1.*"
    }
}

Design goals

  • Usable with a bare minimum of PHP extensions, add more extensions to get better performance.
  • Provide a standalone event-loop component that can be re-used by other libraries.
  • Decouple parts so they can be replaced by alternate implementations.

React is non-blocking by default. Use workers for blocking I/O.

Usage

Events

Most classes extend événement, allowing you to bind to events.

Example

Here is an example of a simple HTTP server listening on port 1337:

<?php

$i = 0;

$app = function ($request, $response) use (&$i) {
    $i++;

    $text = "This is request number $i.\n";
    $headers = array('Content-Type' => 'text/plain');

    $response->writeHead(200, $headers);
    $response->end($text);
};

$stack = new React\Espresso\Stack($app);
$stack->listen(1337);

Community

Check out #reactphp on irc.freenode.net. Also follow @reactphp on twitter.

Tests

To run the test suite, you need PHPUnit.

$ phpunit

License

MIT, see LICENSE.

Something went wrong with that request. Please try again.