Skip to content

Provides integration Swoole Http Request / Response to Symfony Request / Response.

License

Notifications You must be signed in to change notification settings

IndraGunawan/swoole-http-message-bridge

Repository files navigation

Swoole Http Message Bridge

license Source Packagist Travis

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();

About

Provides integration Swoole Http Request / Response to Symfony Request / Response.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages