mouf/silex-middleware

This package provides a StackPHP middleware that can be used to plug a Silex application

1.0.x-dev 2015-05-12 13:30 UTC

This package is auto-updated.

Last update: 2024-09-15 05:18:20 UTC


README

This package contains a StackPHP middleware that unables you to push a Silex application directly on the middleware stack. The Silex application will try to handle requests but instead of sending a 404 response if nothing is found, the next middleware on the stack will be called.

Installation

Through Composer as mouf/silex-middleware.

Usage

Simply use the SilexMiddleWare class in your middleware stack:

use Mouf\StackPhp\SilexMiddleware;
use Silex\Application;
use Stack\Builder;

$app = ...

$silex = new Silex\Application();
$silex->get('/hello', function(Request $request) {
    return 'Hello World!';
});

$stack = (new Stack\Builder())
    ->push(SilexMiddleWare::class, $silex);

$app = $stack->resolve($app);