PHP code example of crowphp / crow
1. Go to this page and download the library: Download crowphp/crow 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/ */
crowphp / crow example snippets
Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface as RequestInterface;
use Crow\Http\Server\Factory as CrowServer;
$app = CrowServer::create(CrowServer::SWOOLE_SERVER);
$router = Crow\Router\Factory::make();
$router->get('/', function (RequestInterface $request, ResponseInterface $response) {
$response->getBody()->write('Hello World');
return $response;
});
$app->withRouter($router);
$app->listen(5005);
bash
$ php index.php