Skip to content

Commit b1ddfd2

Browse files
authored
Fix docs (#100)
1 parent 28d9972 commit b1ddfd2

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

README.md

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<p align="center">
22
<a href="https://github.com/yiisoft" target="_blank">
3-
<img src="https://yiisoft.github.io/docs/images/yii_logo.svg" height="100px">
3+
<img src="https://yiisoft.github.io/docs/images/yii_logo.svg" height="100px" alt="Yii">
44
</a>
55
<h1 align="center">Yii Middleware Dispatcher</h1>
66
<br>
@@ -48,7 +48,7 @@ $dispatcher = new MiddlewareDispatcher(
4848
In the above `$diContainer` is an instance of [PSR-11](https://www.php-fig.org/psr/psr-11/) `\Psr\Container\ContainerInterface`
4949
and `$eventDispatcher` is an instance of [PSR-14](https://www.php-fig.org/psr/psr-14/) `Psr\EventDispatcher\EventDispatcherInterface`.
5050

51-
After dispatcher instance obtained, it should be fed with some middleware:
51+
After dispatcher instance obtained, it should be fed with some middleware:
5252

5353
```php
5454
$dispatcher = $dispatcher->withMiddlewares([
@@ -65,30 +65,33 @@ In the above we have used a callback. Overall the following options are availabl
6565
`index()` method will be executed.
6666
- A name of PSR-15 middleware class. The middleware instance will be obtained from container.
6767
- A name of PSR-15 request handler class. The request handler instance will be obtained from container and executed.
68-
- A name or instance of invokable class. If the name of invokable class is provided, the instance will be
68+
- A name or instance of invokable class. If the name of invokable class is provided, the instance will be
6969
obtained from container and executed.
7070
- A function returning a middleware such as
71+
7172
```php
7273
static function (): MiddlewareInterface {
7374
return new TestMiddleware();
7475
}
7576
```
77+
7678
The middleware returned will be executed.
7779
- A callback `function(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface`.
7880
- An array definition (see [syntax](https://github.com/yiisoft/definitions#arraydefinition)) of middleware:
81+
7982
```php
8083
[
8184
'class' => MyMiddleware::class,
8285
'__construct()' => [
8386
'someVar' => 42,
8487
],
8588
]
86-
```
89+
```
8790

8891
For handler action and callable typed parameters are automatically injected using dependency injection container.
8992
Current request and handler could be obtained by type-hinting for `ServerRequestInterface` and `RequestHandlerInterface`.
9093

91-
After middleware set is defined, you can do the dispatching:
94+
After middleware set is defined, you can do the dispatching:
9295

9396
```php
9497
$request = new ServerRequest('GET', '/teapot');

composer.json

+12-2
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,22 @@
1010
"license": "BSD-3-Clause",
1111
"support": {
1212
"issues": "https://github.com/yiisoft/middleware-dispatcher/issues?state=open",
13+
"source": "https://github.com/yiisoft/middleware-dispatcher",
1314
"forum": "https://www.yiiframework.com/forum/",
1415
"wiki": "https://www.yiiframework.com/wiki/",
1516
"irc": "ircs://irc.libera.chat:6697/yii",
16-
"chat": "https://t.me/yii3en",
17-
"source": "https://github.com/yiisoft/middleware-dispatcher"
17+
"chat": "https://t.me/yii3en"
1818
},
19+
"funding": [
20+
{
21+
"type": "opencollective",
22+
"url": "https://opencollective.com/yiisoft"
23+
},
24+
{
25+
"type": "github",
26+
"url": "https://github.com/sponsors/yiisoft"
27+
}
28+
],
1929
"require": {
2030
"php": "^8.1",
2131
"psr/container": "^1.0|^2.0",

0 commit comments

Comments
 (0)