1. Go to this page and download the library: Download runtime/swoole-nyholm 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/ */
runtime / swoole-nyholm example snippets
// public/index.php
use Swoole\Http\Request;
use Swoole\Http\Response;
esponse) {
$response->header("Content-Type", "text/plain");
$response->end("Hello World\n");
};
};
// public/index.php
use Nyholm\Psr7\Response;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
'] ?? 'World';
return new Response(200, ['Server' => 'swoole-runtime'], "Hello, $name!");
}
}
return function(): RequestHandlerInterface {
return new App();
};