Code Monkey home page Code Monkey logo

react's Introduction

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 = 1;

$app = new React\Espresso\Application();

$app->get('/favicon.ico', function ($request, $response) {
    $response->writeHead(204);
    $response->end();
});

$app->get('/', 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.

react's People

Contributors

igorw avatar cboden avatar nrk avatar arghav avatar chobie avatar lt avatar

Stargazers

Álvaro C avatar  avatar  avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.