All Projects → chubbyphp → chubbyphp-swoole-request-handler

chubbyphp / chubbyphp-swoole-request-handler

Licence: MIT license
A request handler adapter for swoole, using PSR-7, PSR-15 and PSR-17.

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to chubbyphp-swoole-request-handler

request-callback
➰ Swoole request callback for PSR compliant handlers.
Stars: ✭ 22 (+0%)
Mutual labels:  swoole, request-handler
ext-postgresql
🐘 Coroutine-based client for PostgreSQL
Stars: ✭ 62 (+181.82%)
Mutual labels:  swoole
docs
Lawoole documentation
Stars: ✭ 12 (-45.45%)
Mutual labels:  swoole
RidPT
A Private Tracker System
Stars: ✭ 102 (+363.64%)
Mutual labels:  swoole
static-php-cli
Build single static PHP binary in linux, build with PHP project together, with Swoole and other popular extensions included.
Stars: ✭ 129 (+486.36%)
Mutual labels:  swoole
kafka-swoole
☝️Implement all kafka protocols, providing 'HighLevel' and 'LowLevel' client apis respectively, and utilize swoole to realize collaboration and flexibly extend consumers' client, which is the first php-kafka client to support multiple compression forms
Stars: ✭ 33 (+50%)
Mutual labels:  swoole
http
Support Swoole Implement PSR7
Stars: ✭ 28 (+27.27%)
Mutual labels:  swoole
zhamao-framework
协程、高性能、灵活的聊天机器人 & Web 开发框架(炸毛框架)
Stars: ✭ 99 (+350%)
Mutual labels:  swoole
swoole-ide-helper
💪 IDE helper for Swoft and Swoole
Stars: ✭ 42 (+90.91%)
Mutual labels:  swoole
app
Buggregator is a beautiful, lightweight debug server build on Laravel that helps you catch your smpt, sentry, var-dump, monolog, ray outputs. It runs without installation on multiple platforms.
Stars: ✭ 259 (+1077.27%)
Mutual labels:  swoole
gotask
⚡️ A lightning speed replacement for Swoole TaskWorker in Go
Stars: ✭ 164 (+645.45%)
Mutual labels:  swoole
leevel
🚀The Leevel Framework To Rebuild QueryPHP.
Stars: ✭ 35 (+59.09%)
Mutual labels:  swoole
skeleton
基于Swoole的轻量、高效、全异步开源框架。
Stars: ✭ 71 (+222.73%)
Mutual labels:  swoole
awesome-swoole
💎 A curated list of awesome things related to Swoole.
Stars: ✭ 129 (+486.36%)
Mutual labels:  swoole
vertica-swoole-adapter
Provides a DB layer for Swoole-based applications to communicate to HP Vertica databases.
Stars: ✭ 14 (-36.36%)
Mutual labels:  swoole
swoole
Swoole Api references
Stars: ✭ 14 (-36.36%)
Mutual labels:  swoole
framework
🦋The PHP Framework For Code Poem As Free As Wind.
Stars: ✭ 65 (+195.45%)
Mutual labels:  swoole
swoole-laravel-chat
Simple stateless chat board [Swoole + SocketIO + Laravel]
Stars: ✭ 16 (-27.27%)
Mutual labels:  swoole
ultraman
奥特曼
Stars: ✭ 45 (+104.55%)
Mutual labels:  swoole
homebrew-extensions
🍻 Homebrew tap for PHP extensions
Stars: ✭ 264 (+1100%)
Mutual labels:  swoole

chubbyphp-swoole-request-handler

CI Build Status Coverage Status Infection MSI Latest Stable Version Total Downloads Monthly Downloads

bugs code_smells coverage duplicated_lines_density ncloc sqale_rating alert_status reliability_rating security_rating sqale_index vulnerabilities

Description

A request handler adapter for swoole, using PSR-7, PSR-15 and PSR-17.

Requirements

Installation

Through Composer as chubbyphp/chubbyphp-swoole-request-handler.

composer require chubbyphp/chubbyphp-swoole-request-handler "^1.2"

Usage

<?php

declare(strict_types=1);

namespace App;

use Chubbyphp\SwooleRequestHandler\OnRequest;
use Chubbyphp\SwooleRequestHandler\PsrRequestFactory;
use Chubbyphp\SwooleRequestHandler\SwooleResponseEmitter;
use Psr\Http\Server\RequestHandlerInterface;
use Some\Psr17\Factory\ServerRequestFactory;
use Some\Psr17\Factory\StreamFactory;
use Some\Psr17\Factory\UploadedFileFactory;
use Swoole\Http\Server;

$loader = require __DIR__.'/vendor/autoload.php';

/** @var RequestHandlerInterface $app*/
$app = ...;

$http = new Server('0.0.0.0', 8080);

$http->on('start', function (Server $server): void {
    echo 'Swoole http server is started at http://0.0.0.0:8080'.PHP_EOL;
});

$http->on('request', new OnRequest(
    new PsrRequestFactory(
        new ServerRequestFactory(),
        new StreamFactory(),
        new UploadedFileFactory()
    ),
    new SwooleResponseEmitter(),
    $app
));

$http->start();

with blackfire

<?php

declare(strict_types=1);

namespace App;

use Blackfire\Client;
use Chubbyphp\SwooleRequestHandler\Adapter\BlackfireOnRequestAdapter;
use Chubbyphp\SwooleRequestHandler\OnRequest;

/** @var OnRequest $onRequest */
$onRequest = ...;

if (extension_loaded('blackfire') {
    $onRequest = new BlackfireOnRequestAdapter($onRequest, new Client());
}

$http->on('request', $onRequest);

with newrelic

<?php

declare(strict_types=1);

namespace App;

use Chubbyphp\SwooleRequestHandler\Adapter\NewRelicOnRequestAdapter;
use Chubbyphp\SwooleRequestHandler\OnRequest;

/** @var OnRequest $onRequest */
$onRequest = ...;

if (extension_loaded('newrelic') && false !== $name = ini_get('newrelic.appname')) {
    $onRequest = new NewRelicOnRequestAdapter($onRequest, $name);
}

$http->on('request', $onRequest);

Copyright

Dominik Zogg 2022

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].