stas-plov / dto-validator-bundle
Adds validator for middleware request support in your Symfony application
Installs: 167
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=8.1
- psr/log: ^1.0 || ^2.0 || ^3.0
- symfony/config: ^6.0|^7.0
- symfony/dependency-injection: ^6.0|^7.0
- symfony/http-foundation: ^6.0|^7.0
- symfony/http-kernel: ^6.0|^7.0
- symfony/property-info: ^6.0|^7.0
- symfony/serializer: ^6.0|^7.0
- symfony/validator: ^6.0|^7.0
Requires (Dev)
- symfony/phpunit-bridge: ^5.4 || ^6.0 || ^7.0
README
StasPlovDtoValidatorBundle
About
The StasPlovDtoValidatorBundle Validating the Request by DTO in the context of symfony.
The core idea of StasPlovDtoValidatorBundle is to validate input data in the controller from the Request using so-called DTO (Data Transfer Object) entities.
#[ValidateDto(class: CreateDto::class)] #[Route(path: '/create/user', name: 'api-user-create', methods: ['POST'])] public function createUser(CreateDto $createDto): Response { // ... some code }
The $createDto
variable will contain all the data described in the corresponding CreateDto
class.
Installation
Require the stas-plov/dto-validator-bundle
package in your composer.json and update your dependencies:
composer require stas-plov/dto-validator-bundle
Flex, you'll need to enable it manually as explained in the docs.
Usage
See the documentation for usage instructions.
License
Released under the MIT License, see LICENSE.