React-Restify
, (*1)
RESTful api made easy for ReactPHP, seriously., (*2)
Instalation
In your composer.json, (*3)
"require" : {
"capmousse/react-restify": "dev-master"
},
Create server
Here is an exemple of a simple HTTP server replying to all get call like http://127.0.0.1:1337/hello/you, (*4)
require 'vendor/autoload.php';
$server = new CapMousse\ReactRestify\Server("MyAPP", "0.0.0.1");
$server->get('/hello/{name}', function ($request, $response, $next) {
$response->write("Hello ".$request->name);
$next();
});
$runner = new CapMousse\ReactRestify\Runner($server);
$runner->listen(1337);
More examples can be found on the example directory like the Todo example, the most complete, (*5)
Design goals
React-Restify was primary made to build RESTful api easily. It can be used like Silex, but without the framework part., (*6)
Next part will be to support Sockets, Upgrade Requests... to create a real time API server., (*7)
Licence
MIT, see LICENCE file, (*8)