Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: about 1 month 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 (10 months ago)
- Default Branch: main
- Last Pushed: 2024-04-18T06:41:58.000Z (7 months ago)
- Last Synced: 2024-10-01T15:27:04.175Z (about 2 months 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
[![Minimum PHP version: 8.2.0](https://img.shields.io/badge/php-8.2.0%2B-blue.svg)](https://packagist.org/packages/stas-plov/dto-validator-bundle)
[![Latest Stable Version](http://poser.pugx.org/stas-plov/dto-validator-bundle/v)](https://packagist.org/packages/stas-plov/dto-validator-bundle)
[![Total Downloads](http://poser.pugx.org/stas-plov/dto-validator-bundle/downloads)](https://packagist.org/packages/stas-plov/dto-validator-bundle)
[![Latest Unstable Version](http://poser.pugx.org/stas-plov/dto-validator-bundle/v/unstable)](https://packagist.org/packages/stas-plov/dto-validator-bundle)
[![License](http://poser.pugx.org/stas-plov/dto-validator-bundle/license)](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