Provides integration Swoole Http Request / Response to Symfony Request / Response.
Require the package with composer. (indragunawan/api-rate-limit-bundle
on Packagist);
composer require indragunawan/swoole-http-message-bridge
<?php
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();