https://github.com/thecodingmachine/symfony-middleware
This package provides a StackPHP middleware that can be used to use a Symfony application as a middleware (instead of an app)
https://github.com/thecodingmachine/symfony-middleware
Last synced: 7 months ago
JSON representation
This package provides a StackPHP middleware that can be used to use a Symfony application as a middleware (instead of an app)
- Host: GitHub
- URL: https://github.com/thecodingmachine/symfony-middleware
- Owner: thecodingmachine
- Created: 2015-01-28T14:15:19.000Z (almost 11 years ago)
- Default Branch: 1.0
- Last Pushed: 2016-02-09T14:53:30.000Z (almost 10 years ago)
- Last Synced: 2025-06-30T03:09:39.180Z (7 months ago)
- Language: PHP
- Size: 6.84 KB
- Stars: 23
- Watchers: 2
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Symfony middleware for StackPHP
===============================
This package contains a [StackPHP middleware](http://stackphp.com/) 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.
Installation
------------
Through [Composer](https://getcomposer.org/) as [mouf/symfony-middleware](https://packagist.org/packages/mouf/symfony-middleware).
Usage
-----
Simply use the `SymfonyMiddleWare` class in your middleware stack:
```php
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?
----
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 :)