indragunawan / swoole-http-message-bridge
Swoole Http Message Bridge
v0.1.0
2020-03-19 16:18 UTC
Requires
- php: ^7.1
- symfony/http-foundation: ^2.7 || ^3.0 || ^4.0 || ^5.0
Requires (Dev)
- phpunit/phpunit: ^6.5
This package is auto-updated.
Last update: 2024-12-20 02:26:07 UTC
README
Provides integration Swoole Http Request / Response to Symfony Request / Response.
Installation
Require the package with composer. (indragunawan/api-rate-limit-bundle
on Packagist);
composer require indragunawan/swoole-http-message-bridge
Usage
Symfony Request and Response
<?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();