dev-master
9999999-dev https://github.com/onigoetz/reactavelUse Laravel on ReactPHP
The Requires
- php >=5.4.0
- react/http 0.5.*@dev
The Development Requires
laravel lumen l5 reactphp
Wallogit.com
2017 © Pedro Peláez
Use Laravel on ReactPHP
Running Lumen on top of ReactPHP, making fast even faster., (*1)
This is just an experiment and you should not let this near your production environment., (*2)
I have some ideas for this project, we'll se if we can get something out of it., (*3)
composer require onigoetz/reactavel dev-master
You are now ready to roll by running: ./vendor/bin/reactavel, (*4)
If performance is your main goal, you can also try this with HHVM : hhvm -v"Eval.Jit=true" ./vendor/bin/reactavel, (*5)
In the context of an application server, you can't rely on global variables or instances, as they might have informations from other users. In that case, it is recommended to request the Request and/or the Application in your Controller or route., (*6)
use Laravel\Lumen\Application;
use Illuminate\Http\Request;
$app->get(
'/',
function (Application $app) {
return $app->version();
}
);
$app->get(
'/user/{id}',
function ($id, Request $request) {
return [$id, $request->cookies->all()];
}
);
Here is a sample configuration for nginx to serve static files, (*7)
upstream backend_reactavel {
server 127.0.0.1:8080;
}
server {
root /work/external/reactavel/public;
server_name localhost;
listen 8090;
access_log /logs/nginx/reactavel_access.log;
error_log /logs/nginx/reactavel_error.log;
location @reactavel {
proxy_pass http://backend_reactavel;
}
location ~* ^.+\.php$ {
return 404;
}
try_files $uri @reactavel;
}
Because now that all requests run in the same thread, without any cleanup, any state left behind by another request might have side effects., (*8)
Be careful with that., (*9)
Use Laravel on ReactPHP
laravel lumen l5 reactphp