All Projects → friends-of-reactphp → http-middleware-psr15-adapter

friends-of-reactphp / http-middleware-psr15-adapter

Licence: MIT license
A PSR-15 middleware adapter for react/http

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to http-middleware-psr15-adapter

Supervisord
Async first supervisord HTTP API Client for PHP 7
Stars: ✭ 14 (-22.22%)
Mutual labels:  reactphp
Promise
Promises/A implementation for PHP.
Stars: ✭ 2,078 (+11444.44%)
Mutual labels:  reactphp
request-parser
Small PHP Library for type-safe input handling
Stars: ✭ 53 (+194.44%)
Mutual labels:  psr
Reactphp
Event-driven, non-blocking I/O with PHP.
Stars: ✭ 8,211 (+45516.67%)
Mutual labels:  reactphp
Symfony Async Kernel
[Deprecated] Symfony Async Kernel adpater
Stars: ✭ 111 (+516.67%)
Mutual labels:  reactphp
Php Console Spinner
Colorful highly configurable spinner for php cli applications (suitable for async apps)
Stars: ✭ 225 (+1150%)
Mutual labels:  reactphp
Reactphp Symfony
Symfony 4 Hello World example running on ReactPHP.
Stars: ✭ 24 (+33.33%)
Mutual labels:  reactphp
composer-library-template
Skeleton for creating a new Composer Library
Stars: ✭ 51 (+183.33%)
Mutual labels:  psr
Demo
Demo for DriftPHP
Stars: ✭ 117 (+550%)
Mutual labels:  reactphp
slim-skeleton
Slim Framework skeleton application following MVC construction
Stars: ✭ 18 (+0%)
Mutual labels:  psr
React Restify
A ReactPHP framework to create RESTfull api
Stars: ✭ 87 (+383.33%)
Mutual labels:  reactphp
Zanzara
Asynchronous PHP Telegram Bot Framework built on top of ReactPHP
Stars: ✭ 107 (+494.44%)
Mutual labels:  reactphp
Child Process
Event-driven library for executing child processes with ReactPHP.
Stars: ✭ 225 (+1150%)
Mutual labels:  reactphp
Event Loop
ReactPHP's core reactor event loop that libraries can use for evented I/O.
Stars: ✭ 945 (+5150%)
Mutual labels:  reactphp
net-mqtt-client-react
Asynchronous MQTT client built on React
Stars: ✭ 45 (+150%)
Mutual labels:  reactphp
Reactphp Reactjs Hostname Analyzer Example
Stars: ✭ 8 (-55.56%)
Mutual labels:  reactphp
Hhvmcraft
📦 Minecraft Beta 1.7.3 Server implemented in PHP/HHVM, powered by ReactPHP.
Stars: ✭ 180 (+900%)
Mutual labels:  reactphp
pecan
ReactPHP Shell, based on the Symfony Console component.
Stars: ✭ 43 (+138.89%)
Mutual labels:  reactphp
psrcas
PSR CAS, a PHP standard library for CAS authentication.
Stars: ✭ 21 (+16.67%)
Mutual labels:  psr
Http Client
[Deprecated] Event-driven, streaming HTTP client for ReactPHP.
Stars: ✭ 228 (+1166.67%)
Mutual labels:  reactphp

A PSR-15 middleware adapter for react/http

CI status

Wraps PSR-15 middleware using async and await from react/async utilizing fibers making them usable within react/http as middleware.

Install

To install via Composer, use the command below, it will automatically detect the latest version and bind it with ^.

composer require for/http-middleware-psr15-adapter

Usage

The following usage example uses middlewares/redirect adding one redirect, and using the callback to call several methods on the redirect middleware to change it's behavior:

$server = new Server(
    /** Other middleware */
    new PSR15Middleware(
        (new Redirect(['/old-url' => '/new-url']))->permanent(false)->query(false)->method(['GET', 'POST'])
    ),
    /** Other middleware */
);

Grouped Usage

When using more then one PSR-15 in a row the GroupedPSR15Middleware is more performing than using multiple PSR15Middleware. Consider the following example where we add middlewares/cache for expires headers:

$loop = Factory::create(); 
$server = new Server([
    /** Other middleware */
    (new GroupedPSR15Middleware($loop))->withMiddleware( 
        (new Redirect(['/old-url' => '/new-url']))->permanent(false)->query(false)->method(['GET', 'POST'])
    )->withMiddleware(
        new Expires()
    ),
    /** Other middleware */
]);
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].