Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions developer_manual/basics/middlewares.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ Middleware is logic that is run before and after each request and is modelled af
* ``afterController``: This is being run after a successful controller method call and allows the manipulation of a Response object. The middleware is run in reverse order
* ``beforeOutput``: This is being run after the response object has been rendered and allows the manipulation of the outputted text. The middleware is run in reverse order

.. figure:: ../images/middleware-flow-horiz.png
:alt: Middleware flow chart

To generate your own middleware, simply inherit from the Middleware class and overwrite the methods that should be used.


Expand Down Expand Up @@ -128,7 +131,7 @@ Middlewares can also be added using the **registerMiddleware** method of the con

public function __construct(array $urlParams = []) {
parent::__construct('myapp', $urlParams);

$container = $this->getContainer();

// executed in the order that it is registered
Expand All @@ -142,7 +145,7 @@ Middlewares can also be added using the **registerMiddleware** method of the con
The order is important! The middleware that is registered first gets run first in the **beforeController** method. For all other hooks, the order is being reversed, meaning: if a middleware is registered first, it gets run last.


Parsing annotations
Parsing annotations
-------------------

Sometimes it is useful to conditionally execute code before or after a controller method. This can be done by defining custom annotations. An example would be to add a custom authentication method or simply add an additional header to the response. To access the parsed annotations, inject the **ControllerMethodReflector** class:
Expand Down
Binary file added developer_manual/images/middleware-flow-horiz.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.