stas-plov/dto-validator-bundle

Adds validator for middleware request support in your Symfony application

v1.1.4 2024-04-18 06:38 UTC

This package is auto-updated.

Last update: 2024-10-22 12:16:29 UTC


README

Minimum PHP version: 8.2.0 Latest Stable Version Total Downloads Latest Unstable Version License

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.