PHPackages                             mojtaba-gheytasi/request-validator-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. mojtaba-gheytasi/request-validator-bundle

ActiveSymfony-bundle[Validation &amp; Sanitization](/categories/validation)

mojtaba-gheytasi/request-validator-bundle
=========================================

Symfony bundle for validating request parameters in a clean structure

v0.1.0(4y ago)26[1 PRs](https://github.com/mojtaba-gheytasi/request-validator-bundle/pulls)MITPHPPHP &gt;=7.4

Since Aug 14Pushed 1y ago1 watchersCompare

[ Source](https://github.com/mojtaba-gheytasi/request-validator-bundle)[ Packagist](https://packagist.org/packages/mojtaba-gheytasi/request-validator-bundle)[ Docs](https://github.com/mojtaba-gheytasi/request-validator-bundle)[ RSS](/packages/mojtaba-gheytasi-request-validator-bundle/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (9)Versions (3)Used By (0)

Symfony Request Validator Bundle
---------------------------------

[](#symfony-request-validator-bundle)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/08af2a786ace68ee4a29ac06b3e32b8a000f33049139f3f93c1a6c337bf8efd8/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d6f6a746162612d67686579746173692f726571756573742d76616c696461746f722d62756e646c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/mojtaba-gheytasi/request-validator-bundle/?branch=main)[![Build Status](https://camo.githubusercontent.com/0f6d0c931120488779c1bf511a9cf1fc6996aca1a0139265ce275292b12f4fbd/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d6f6a746162612d67686579746173692f726571756573742d76616c696461746f722d62756e646c652f6261646765732f6275696c642e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/mojtaba-gheytasi/request-validator-bundle/build-status/main)

What does it do? :)
-------------------

[](#what-does-it-do-)

This bundle allows you to validate request parameters based on your constraints and restrictions via request classes that contain validation logic.

Installation
------------

[](#installation)

```
composer require mojtaba-gheytasi/request-validator-bundle
```

Compatibility
-------------

[](#compatibility)

- PHP v7.4 or above
- Symfony v4.4 or above

Usage
-----

[](#usage)

Suppose you want to validate incoming request parameters as follows:

```
//Get api/product/search?brand=gucci&price[min]=100&price[max]=1000
[
    'brand' => 'gucci',
    'price' => [
        'min' => 100,
        'max' => 1000,
    ],
];
```

To start, create a request class by following command:

```
$ bin/console make:request SearchProduct
```

**NOTE**: Creates SearchProductRequest.php in src/Request.

Now add your validation constraints to the constraints method:

```
