2017 © Pedro Peláez
 

library swoole-bridge

Swoole Bridge For Php Frameworks

image

insidestyles/swoole-bridge

Swoole Bridge For Php Frameworks

  • Thursday, June 21, 2018
  • by insidestyles
  • Repository
  • 1 Watchers
  • 0 Stars
  • 11 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 175 % Grown

The README.md

swoole-bridge

Swoole Bridge For Php Frameworks. Currently supports: * Symfony * Zend Expressive * Laravel, (*1)

Requirements

Installation

This package is installable and autoloadable via Composer, (*2)

composer require insidestyles/swoole-bridge

Usage

example:
<?php
   $kernel = new Kernel($env, $debug);//App\Kernel or AppKernel;
   $psr15Kernel = new \Insidestyles\SwooleBridge\Adapter\Kernel\Psr15SymfonyKernel($kernel);

   //Laravel: $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
   //$psr15Kernel = new \Insidestyles\SwooleBridge\Adapter\Kernel\Psr15IlluminateKernel($kernel);

   //Zend Expressive: $psr15Kernel = $container->get(\Zend\Expressive\Application::class);

   $host = '127.0.0.1';
   $port = 8080;

   $http = new \swoole_http_server($host, $port);
   $responseEmitter = new \Insidestyles\SwooleBridge\Emiter\SwooleResponseEmitter();
   $requestBuilderFactory = new \Insidestyles\SwooleBridge\Builder\RequestBuilderFactory();
   $factory = new \Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory();
   $adapter = new \Insidestyles\SwooleBridge\Adapter\SymfonyAdapter($responseEmitter, $psr15Kernel, $requestBuilderFactory);
   $logger = new \Psr\Log\NullLogger();
   $handler = new \Insidestyles\SwooleBridge\Handler($adapter, $logger);

   $http->on(
       'request',
       function (\Swoole\Http\Request $request, \Swoole\Http\Response $response) use ($handler) {
           $handler->handle($request, $response);
       }
   );

   $http->start();

TODO

  • [x] Laravel support?
  • [ ] Yii support?

The Versions

20/06 2018
08/05 2018

dev-release-0.1

dev-release-0.1

Swoole Bridge For Php Frameworks

  Sources   Download

MIT

The Requires

 

The Development Requires

by fuong

08/05 2018