juliangut / server-handler-swoole
Swoole with PSR-15
dev-master
2020-02-20 11:39 UTC
Requires
- php: ^7.1
- ext-swoole: ^4.4.6
- dflydev/fig-cookies: ^1.0|^2.0
- psr/http-factory: ^1.0
- psr/http-server-handler: ^1.0
- psr/log: ^1.1
Requires (Dev)
- brainmaestro/composer-git-hooks: ^2.8
- friendsofphp/php-cs-fixer: ^2.16
- infection/infection: ^0.13|^0.15
- laminas/laminas-diactoros: ^2.1
- mikey179/vfsstream: ^1.6
- overtrue/phplint: ^1.2
- phpmd/phpmd: ^2.8
- phpstan/extension-installer: ^1.0.3
- phpstan/phpstan: ^0.12
- phpstan/phpstan-deprecation-rules: ^0.12
- phpstan/phpstan-strict-rules: ^0.12
- phpunit/phpunit: ^7.5|^8.0
- povils/phpmnd: ^2.1
- roave/security-advisories: dev-master
- sebastian/phpcpd: ^4.0
- squizlabs/php_codesniffer: ^3.5
- swoft/swoole-ide-helper: ^4.4
- thecodingmachine/phpstan-strict-rules: ^0.12
Suggests
- ext-inotify: In order to use server reloading based on inotify file watcher.
This package is auto-updated.
Last update: 2024-10-20 22:16:57 UTC
README
juliangut/server-handler-swoole
Easily run Swoole server with any implementation of PSR-15 RequestHandlerInterface
Installation
Composer
composer require juliangut/server-handler-swoole
Usage
Require composer autoload file
require './vendor/autoload.php'; use Jgut\ServerHandler\Swoole\Http\PsrRequestFactory; use Jgut\ServerHandler\Swoole\Http\SwooleResponseFactory; use Swoole\Http\Server as SwooleServer; $swooleServer = new SwooleServer('127.0.0.1', 8080, \SWOOLE_BASE, \SWOOLE_SOCK_TCP); $swooleServer->set([ 'max_conn' => 1024, 'enable_coroutine' => false, ]); $requestFactory = new PsrRequestFactory( /* \Psr\Http\Message\ServerRequestFactoryInterface */, /* \Psr\Http\Message\UriFactoryInterface */, /* \Psr\Http\Message\StreamFactoryInterface */, /* \Psr\Http\Message\UploadedFileFactoryInterface */ ); $responseFactory = new SwooleResponseFactory(); $server = new Server( $swooleServer, /* Psr\Http\Server\RequestHandlerInterface */, $requestFactory, $responseFactory, true ); $server->run();
Contributing
Found a bug or have a feature request? Please open a new issue. Have a look at existing issues before.
See file CONTRIBUTING.md
License
See file LICENSE included with the source code for a copy of the license terms.