PHP code example of indragunawan / swoole-http-message-bridge
1. Go to this page and download the library: Download indragunawan/swoole-http-message-bridge 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/ */
indragunawan / swoole-http-message-bridge example snippets
use Indragunawan\SwooleHttpMessageBridge\Symfony\Request;
use Indragunawan\SwooleHttpMessageBridge\Symfony\Response;
$http = new swoole_http_server(/*...*/);
$http->on('request', function (swoole_http_request $request, swoole_http_response $response) {
$sfRequest = Request::createFromSwooleRequest($request);
// ...
// $sfResponse = run_something_here that return Symfony response
Response::writeSwooleResponse($response, $sfResponse);
// ...
$response->end();
});
$http->start();