This package provides a StackPHP middleware that can be used to use a Symfony application as a middleware (instead of an app)

v0.1.0 2015-07-10 09:02 UTC

This package is auto-updated.

Last update: 2024-06-15 04:22:44 UTC


Symfony middleware for StackPHP

This package contains a StackPHP middleware that enables you to push a Symfony application (actually a Kernel) directly on the middleware stack. The Symfony application will try to handle requests but instead of sending a 404 response if no route is found, the next middleware on the stack will be called.


Through Composer as mouf/symfony-middleware.


Simply use the SymfonyMiddleWare class in your middleware stack:

use Mouf\StackPhp\SymfonyMiddleware;
use My\Symfony\Application;
use Stack\Builder;

$app = ...

$symfonyApplication = new Application(...);

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

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


Why would I want to make a Symfony app a middleware? Because if every app becomes a middleware, we can easily chain middlewares together, and therefore, chain many frameworks in the same application... and this is cool :)