You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+9
Original file line number
Diff line number
Diff line change
@@ -71,6 +71,15 @@ In the above we have used a callback. Overall the following options are availabl
71
71
```
72
72
The middleware returned will be executed.
73
73
- A callback `function(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface`.
74
+
- An array definition (see [syntax](https://github.com/yiisoft/definitions#arraydefinition)) of middleware:
75
+
```php
76
+
[
77
+
'class' => MyMiddleware::class,
78
+
'__construct()' => [
79
+
'someVar' => 42,
80
+
],
81
+
]
82
+
```
74
83
75
84
For handler action and callable typed parameters are automatically injected using dependency injection container.
76
85
Current request and handler could be obtained by type-hinting for `ServerRequestInterface` and `RequestHandlerInterface`.
Copy file name to clipboardexpand all lines: src/MiddlewareDispatcher.php
+1
Original file line number
Diff line number
Diff line change
@@ -62,6 +62,7 @@ public function dispatch(
62
62
* - A controller handler action in format `[TestController::class, 'index']`. `TestController` instance will
63
63
* be created and `index()` method will be executed.
64
64
* - A function returning a middleware. The middleware returned will be executed.
65
+
* - An array definition of middleware ({@link https://github.com/yiisoft/definitions#arraydefinition}).
65
66
*
66
67
* For handler action and callable
67
68
* typed parameters are automatically injected using dependency injection container.
0 commit comments