1. Go to this page and download the library: Download react/espresso library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
react / espresso example snippets
$app = new React\Espresso\Application();
$app->get('/', function ($request, $response) {
$response->writeHead(200, array('Content-Type' => 'text/plain'));
$response->end("Hello World\n");
});
$app->get('/favicon.ico', function ($request, $response) {
$response->writeHead(204);
$response->end();
});
$app->get('/humans.txt', function ($request, $response) {
$response->writeHead(200, array('Content-Type' => 'text/plain'));
$response->end("I believe you are a humanoid robot.\n");
});
$stack = new React\Espresso\Stack($app);
$stack->listen(1337);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.