Skip to content

Commit 55f5d70

Browse files
author
Mokhtar Tlili
committed
update changelog/readme files
1 parent 5c1e093 commit 55f5d70

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 1.2.3
4+
- Register services in bundle extension file
5+
- Fix exceptions issues
6+
- Add .gitattributes
7+
38
## 1.2.2
49
- Handle deserialization exceptions
510
- Update composer.json minimum-stability

README.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
- Request data supported: `json`, `xml` and `form` based on header content type.
99
- Resolve inputs arguments for controllers actions.
10+
- Create DTO inputs outside controllers
1011
- Validate DTO inputs objects.
1112
- Global YAML configuration.
1213
- Custom Configuration via Input Attribute per controller action.
@@ -86,7 +87,7 @@ Content-Type: application/problem+json; charset=utf-8
8687
}
8788
```
8889

89-
### Deserialization (v1.2.2)
90+
### Deserialization
9091

9192
Whether the request data contains invalid syntax or invalid attributes types a clear 400 json response will return:
9293

@@ -126,6 +127,34 @@ request_input:
126127
127128
You can also override the format using attribute input and specify the format explicitly.
128129
130+
### Create DTO input outside controller
131+
132+
You just need to inject `InputFactoryInterface` e.g:
133+
```php
134+
<?php
135+
136+
declare(strict_types=1);
137+
138+
namespace App\Manager;
139+
140+
use App\Dto\PostInput;
141+
use Sfmok\RequestInput\InputInterface;
142+
use Symfony\Component\HttpFoundation\Request;
143+
use Sfmok\RequestInput\Factory\InputFactoryInterface;
144+
145+
class PostManager
146+
{
147+
public function __construct(private InputFactoryInterface $inputFactory)
148+
{
149+
}
150+
151+
public function getInput(Request $request): InputInterface
152+
{
153+
return $this->inputFactory->createFromRequest($request, PostInput::class, 'json');
154+
}
155+
}
156+
```
157+
129158
## License
130159

131160
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

0 commit comments

Comments
 (0)