https://github.com/stasplov/stasplovdtovalidatorbundle
Validating the Request by DTO in the context of symfony
https://github.com/stasplov/stasplovdtovalidatorbundle
api bundle dto rest rest-api symfony validate validator
Last synced: 6 months ago
JSON representation
Validating the Request by DTO in the context of symfony
- Host: GitHub
- URL: https://github.com/stasplov/stasplovdtovalidatorbundle
- Owner: StasPlov
- License: other
- Created: 2024-01-09T00:40:41.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-18T06:41:58.000Z (about 2 years ago)
- Last Synced: 2025-03-24T02:48:20.564Z (over 1 year ago)
- Topics: api, bundle, dto, rest, rest-api, symfony, validate, validator
- Language: PHP
- Homepage: https://packagist.org/packages/stas-plov/dto-validator-bundle
- Size: 43.9 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
- Security: SECURITY.md
Awesome Lists containing this project
README
[](https://packagist.org/packages/stas-plov/dto-validator-bundle)
[](https://packagist.org/packages/stas-plov/dto-validator-bundle)
[](https://packagist.org/packages/stas-plov/dto-validator-bundle)
[](https://packagist.org/packages/stas-plov/dto-validator-bundle)
[](https://packagist.org/packages/stas-plov/dto-validator-bundle)
# 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.
```php
#[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:
```bash
composer require stas-plov/dto-validator-bundle
```
Flex, you'll need to enable it manually as explained [in the docs][1].
## Usage
See [the documentation][2] for usage instructions.
## License
Released under the MIT License, see LICENSE.
[1]: https://symfony.com/doc/current/setup/flex.html
[2]: ./Resources//doc//HowToUse.md