PHPackages                             digitalrevolution/symfony-request-validation - 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. digitalrevolution/symfony-request-validation

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

digitalrevolution/symfony-request-validation
============================================

Automatic request validation for symfony

v3.0.0(4mo ago)1296.0k↑22.7%1[1 issues](https://github.com/123inkt/symfony-request-validation/issues)MITPHPPHP &gt;=8.1CI passing

Since Jun 3Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/123inkt/symfony-request-validation)[ Packagist](https://packagist.org/packages/digitalrevolution/symfony-request-validation)[ RSS](/packages/digitalrevolution-symfony-request-validation/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (15)Versions (15)Used By (0)

[![Minimum PHP Version](https://camo.githubusercontent.com/230588f62e4b3ba29858fcfcf1bbfe253f82c4180088091d6c7d4c6c06d80145/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230382e312d383839324246)](https://php.net/)[![Minimum Symfony Version](https://camo.githubusercontent.com/992497ffd816cda0638ec1832ef1c6caac7185ddaa96a96d79f85e8f2ddf4880/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73796d666f6e792d253345253344253230362e322d627269676874677265656e)](https://symfony.com/doc/current/validation.html)[![Run tests](https://github.com/123inkt/symfony-request-validation/actions/workflows/test.yml/badge.svg)](https://github.com/123inkt/symfony-request-validation/actions/workflows/test.yml/badge.svg)

Symfony Request Validation
==========================

[](#symfony-request-validation)

A request validation component for Symfony. Ease the validation of request properties without the need for an entire Symfony Form.

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

[](#installation)

Include the library as dependency in your own project via:

```
composer require "digitalrevolution/symfony-request-validation"
```

Update `/config/bundles.php`:

```
return [
    ...
    DigitalRevolution\SymfonyRequestValidation\Bundle\RequestValidationBundle::class => ['all' => true],
];
```

Usage
-----

[](#usage)

1. Create your own `ExampleRequest` class which extends the `AbstractValidatedRequest` class.
2. Configure your own `ValidationRules`. See the [Validation shorthand library](https://github.com/123inkt/symfony-validation-shorthand) for more information about the rules.
3. Ensure your `ExampleRequest` class is registered as [service in your Symfony project](https://symfony.com/doc/current/service_container.html).

```
use DigitalRevolution\SymfonyRequestValidation\AbstractValidatedRequest;
use DigitalRevolution\SymfonyRequestValidation\ValidationRules;

class ExampleRequest extends AbstractValidatedRequest
{
    protected function getValidationRules(): ValidationRules
    {
        return new ValidationRules([
            'request' => [
                'productId'   => 'required|int|min:0',
                'productName' => 'required|string|between:50,255'
            ]
        ]);
    }

    public function getProductId(): int
    {
        return $this->request->request->getInt('productId');
    }

    public function getProductName(): string
    {
        return $this->request->request->getString('productName');
    }
}
```

All that remains is using your `ExampleRequest` class in your `Controller` and it will only be invoked when the request validation passes.

```
class ExampleController
{
    /**
     * @Route("/", name="my_example")
     */
    public function index(ExampleRequest $request): Response
    {
        return ...;
    }
}
```

Invalid request handling
------------------------

[](#invalid-request-handling)

By default if a request is invalid an `InvalidRequestException` will be thrown. If you prefer a different behaviour, overwrite the `handleViolations`method.

```
class ExampleRequest extends AbstractValidatedRequest
{
    ...

    protected function handleViolations(ConstraintViolationListInterface $violationList): void
    {
        $renderer = new ViolationListRenderer($violationList);
        $this->logger->error($renderer->render());
    }
}
```

Note: if no exceptions are thrown in the `handleViolations`, you'll always receive a request in your `Controller`. Use `Request->isValid()` to verify the request is valid.

About us
--------

[](#about-us)

At 123inkt (Part of Digital Revolution B.V.), every day more than 50 development professionals are working on improving our internal ERP and our several shops. Do you want to join us? [We are looking for developers](https://www.werkenbij123inkt.nl/zoek-op-afdeling/it).

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance76

Regular maintenance activity

Popularity38

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 77.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~169 days

Recently: every ~242 days

Total

13

Last Release

140d ago

Major Versions

v1.0.5 → v2.0.02022-09-09

v2.4.0 → v3.0.02025-12-30

PHP version history (5 changes)v1.0.0PHP 7.1.\* || 7.2.\* || 7.3.\*

v1.0.1PHP 7.1.\* || 7.2.\* || 7.3.\* || 7.4.\*

v1.0.2PHP &gt;=7.1

v1.0.5PHP &gt;=7.4

v2.4.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/d144b8d21d1631a75230f12330a9cb0ef6608581a5e6989c18677ac52295e271?d=identicon)[FrankDekker](/maintainers/FrankDekker)

![](https://www.gravatar.com/avatar/20e2ae81f6cffdb8c1b1a488b7f2f70270a5d1bf2a57aae09950697ac0ef3dad?d=identicon)[123Tim](/maintainers/123Tim)

---

Top Contributors

[![frankdekker](https://avatars.githubusercontent.com/u/2179983?v=4)](https://github.com/frankdekker "frankdekker (92 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (10 commits)")[![bram123](https://avatars.githubusercontent.com/u/7457368?v=4)](https://github.com/bram123 "bram123 (9 commits)")[![PrinsFrank](https://avatars.githubusercontent.com/u/25006490?v=4)](https://github.com/PrinsFrank "PrinsFrank (7 commits)")[![Nekroido](https://avatars.githubusercontent.com/u/6490532?v=4)](https://github.com/Nekroido "Nekroido (1 commits)")

---

Tags

requestsymfonysymfony-bundlevalidation

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/digitalrevolution-symfony-request-validation/health.svg)

```
[![Health](https://phpackages.com/badges/digitalrevolution-symfony-request-validation/health.svg)](https://phpackages.com/packages/digitalrevolution-symfony-request-validation)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k16.7M310](/packages/easycorp-easyadmin-bundle)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
