From 650b37692ebee23b357af12666e57b992881be1b Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Thu, 26 Jan 2023 09:55:22 +0100 Subject: [PATCH] feat(dev-manual): Document global middleware registration Signed-off-by: Christoph Wurst --- developer_manual/basics/middlewares.rst | 37 +++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/developer_manual/basics/middlewares.rst b/developer_manual/basics/middlewares.rst index f690776ff3c..106337fce4a 100644 --- a/developer_manual/basics/middlewares.rst +++ b/developer_manual/basics/middlewares.rst @@ -66,6 +66,43 @@ The middleware can be registered in the app's ``Application`` class: } +Global Middlewares +------------------ + +.. versionadded:: 26 + +Registered middlewares will only intercept requests of the same app by default. To make a middleware *global* and trigger for other apps' middlewares, add `true` as second argument of the ``registerMiddleware`` call: + +.. code-block:: php + :caption: lib/AppInfo/Application.php + :emphasize-lines: 20 + + registerMiddleware(MonitoringMiddleware::class, true); + } + + public function boot(IBootContext $context): void {} + + } + Dependency Injection Container Registration -------------------------------------------