brenodouglas / react-restify
Create RESTful API with ReactPHP
0.3.0
2016-01-08 10:52 UTC
Requires
- guzzlehttp/promises: ^1.0
- react/http: dev-master
This package is not auto-updated.
Last update: 2024-12-17 20:16:17 UTC
README
RESTful api made easy for ReactPHP, seriously.
##Instalation
In your composer.json
"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
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
Design goals
React-Restify was primary made to build RESTful api easily. It can be used like Silex, but without the framework part.
Next part will be to support Sockets, Upgrade Requests... to create a real time API server.
##Licence
MIT, see LICENCE file