All Projects → slince → middleware

slince / middleware

Licence: MIT license
🐳 A PSR15 middleware dispatcher

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to middleware

Middleman
Dead simple PSR-15 / PSR-7 middleware dispatcher
Stars: ✭ 87 (+480%)
Mutual labels:  dispatcher
wasmcloud-otp
wasmCloud host runtime that leverages Elixir/OTP and Rust to provide simple, secure, distributed application development using the actor model
Stars: ✭ 197 (+1213.33%)
Mutual labels:  dispatcher
cqrs
A foundational package for Command Query Responsibility Segregation (CQRS) compatible with Laravel.
Stars: ✭ 37 (+146.67%)
Mutual labels:  dispatcher
Ml Model Ci
MLModelCI is a complete MLOps platform for managing, converting, profiling, and deploying MLaaS (Machine Learning-as-a-Service), bridging the gap between current ML training and serving systems.
Stars: ✭ 122 (+713.33%)
Mutual labels:  dispatcher
General Store
Simple, flexible store implementation for Flux. #hubspot-open-source
Stars: ✭ 171 (+1040%)
Mutual labels:  dispatcher
burp-aem-scanner
Burp Scanner extension to fingerprint and actively scan instances of the Adobe Experience Manager CMS. It checks the website for common misconfigurations and security holes.
Stars: ✭ 60 (+300%)
Mutual labels:  dispatcher
Vos backend
vangav open source - backend; a backend generator (generates more than 90% of the code needed for big scale backend services)
Stars: ✭ 71 (+373.33%)
Mutual labels:  dispatcher
jobor
支持秒级分布式定时任务系统, A high performance distributed task scheduling system, Support multi protocol scheduling tasks
Stars: ✭ 52 (+246.67%)
Mutual labels:  dispatcher
Easyrouter
A component routing framework simple, stable and high-performance, which supports UI, Method Calls, Interceptors, Callbacks and More than these.
Stars: ✭ 172 (+1046.67%)
Mutual labels:  dispatcher
aem-dispatcher-experiments
Experiments to demonstrate the impact of the Dispatcher and it's configuration parameters.
Stars: ✭ 41 (+173.33%)
Mutual labels:  dispatcher
Vim Clap
👏 Modern performant fuzzy picker for Vim and NeoVim
Stars: ✭ 1,802 (+11913.33%)
Mutual labels:  dispatcher
Kommander Ios
A lightweight, pure-Swift library for manage the task execution in different threads. Through the definition a simple but powerful concept, Kommand.
Stars: ✭ 167 (+1013.33%)
Mutual labels:  dispatcher
atomic-state
Atomic State is a state management library for React
Stars: ✭ 15 (+0%)
Mutual labels:  dispatcher
Loafer
Asynchronous message dispatcher - Currently using asyncio and amazon SQS
Stars: ✭ 104 (+593.33%)
Mutual labels:  dispatcher
lamp-luwak
Service-oriented state management for React
Stars: ✭ 12 (-20%)
Mutual labels:  dispatcher
Fluxxan
Fluxxan is an Android implementation of the Flux Architecture that combines concepts from both Fluxxor and Redux.
Stars: ✭ 80 (+433.33%)
Mutual labels:  dispatcher
openvpn-shapeshifter
This script will automatically guide you to install and configure your OpenVPN server with Shapeshifter Dispatcher (obfuscation) which will allow you to bypass the DPI blockage on OpenVPN. This setup will offer the users the freedom to choose between regular OpenVPN connection or obfuscated one, they actually can use both! OpenVPN is the VPN pro…
Stars: ✭ 59 (+293.33%)
Mutual labels:  dispatcher
http-multiserver.cr
Mount multiple web applications 🚦
Stars: ✭ 23 (+53.33%)
Mutual labels:  dispatcher
broker
Dead simple PSR-15 middleware dispatcher
Stars: ✭ 26 (+73.33%)
Mutual labels:  dispatcher
flux-redux
An application implementing Flux and Redux with few other dependencies
Stars: ✭ 24 (+60%)
Mutual labels:  dispatcher

Middleware Dispatcher

Build Status Coverage Status Latest Stable Version Scrutinizer

The package is a flexible PSR-15 middleware dispatcher for PSR-7 request message that help to create middlewares and dispatch.

Installation

Install via composer

composer require slince/middleware

Quick example

$dispatcher = new Slince\Middleware\Dispatcher([$middleware1, $middleware2]);

$response = $dispatcher->process(Zend\Diactoros\ServerRequestFactory::fromGlobals());

var_dump($response instanceof Psr\Http\Message\ResponseInterface);

Usage

Add middleware

Add PSR-15 middlewares to the queue

use Psr\Http\Message\ServerRequestInterface;
use Interop\Http\Server\MiddlewareInterface;
use Interop\Http\Server\RequestHandlerInterface;
use Zend\Diactoros\Response;

class MyMiddleware implements MiddlewareInteface
{
    public function process(ServerRequestInterface $request, RequestHandlerInterface $next) 
    {
        $response = new Response();
        $response->getBody()->write('hello world');
        return $response;
    }
}
$dispatcher = new Slince\Middleware\Dispatcher([
    new MyMiddleware()
]);

Or add a callable function directly

$dispatcher->push(function(ServerRequestInterface $request, RequestHandlerInterface $next){
    return $delegate->process($request);
});

Dispatch

try {
    $response = $dispatcher->process(Zend\Diactoros\ServerRequestFactory::fromGlobals());
} catch (Slince\Middleware\Exception\MissingResponseException $exception) {
    //...
}

A MissingResponseException will be thrown if the middleware did not return a invalid response or the queue was exhausted

License

The MIT license. See MIT

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].