PHPackages                             flavacaster/symfony-http-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. [HTTP &amp; Networking](/categories/http)
4. /
5. flavacaster/symfony-http-bundle

ActiveSymfony-bundle[HTTP &amp; Networking](/categories/http)

flavacaster/symfony-http-bundle
===============================

symfony http request validator bundle

v1.0.21(3y ago)0159MITPHPPHP ^8.1

Since Jan 31Pushed 3y agoCompare

[ Source](https://github.com/flavacaster/symfony-http-bundle)[ Packagist](https://packagist.org/packages/flavacaster/symfony-http-bundle)[ RSS](/packages/flavacaster-symfony-http-bundle/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (9)Versions (23)Used By (0)

About
=====

[](#about)

This package still under development.

Requests injection
------------------

[](#requests-injection)

How it works:

- You create request class, describe it structure with JMS serializer annotations and Symfony validation annotations.
- You inject request in your controller action.
- Bundle validates request according to your request class, if request is invalid, it throws custom validation exception.
- If request is valid, it is deserialized to your request class.

Important note: HTTP request fields always come as strings, to validate them correctly, they are soft casted according to type annotations in request class.

You can register listener, that will convert `Flavacaster\SymfonyHttpBundle\EventListener\RequestPayloadExceptionListener` exception to `json` response:

```
# (config/services.yaml)

services:
    # ...

    Flavacaster\SymfonyHttpBundle\EventListener\RequestPayloadExceptionListener:
        tags:
            - { name: kernel.event_listener, event: kernel.exception }

```

Example:

Request class:

```
use Flavacaster\SymfonyHttpBundle\Interfaces\RequestPayloadInterface;

final class CreateUserRequest implements RequestPayloadInterface
{
    /**
     * @Constraints\NotBlank
     * @Constraints\Type(type="string")
     */
    private string $username;

    /**
     * @Constraints\NotBlank
     * @Constraints\Type(type="integer")
     */
    private int $age;

    /**
     * @Constraints\NotBlank
     * @Constraints\Type(type="bool")
     */
    private bool $terms;
}
```

Controller action:

```
/**
 * @Route("/api/endpoint")
 */
public function create(CreateUserRequest $request): Response
{
    dd($request);
}
```

Response for request without parameters:

```
{
  "code": 422,
  "message": "Validation error occurred",
  "errors": {
    "[username]": "This field is missing.",
    "[age]": "This field is missing.",
    "[terms]": "This field is missing."
  }
}
```

Nested objects and array of objects
-----------------------------------

[](#nested-objects-and-array-of-objects)

Nested objects and arrays of objects are handled with `Flavacaster/symfony-validators-bundle` package.

Example:

```
final class Request implements RequestPayloadInterface
{
    /**
     * @Constraints\NotBlank
     * @NestedObject(NestedObject::class)
     */
    private NestedObject $select2;

    /**
     * @Constraints\NotBlank
     * @NestedObjects(NestedObject::class)
     *
     * @Serializer\Type("array")
     */
    private array $list;
}
```

Arrays
------

[](#arrays)

One remark about arrays: arrays of integer/float/bool must have `@var` annotation describing their inner elements scalar type. It needed for soft type casting before validation. Available values: `int[]`, `float[]`, `boolean[]`, `string[]`.

Example:

```
final class Request implements RequestPayloadInterface
{
    /**
     * @Constraints\NotBlank
     *
     * @Serializer\Type("array")
     * @var float[]
     */
    private array $amounts;
}
```

AllowExtraFields and AllowMissingFields
---------------------------------------

[](#allowextrafields-and-allowmissingfields)

Validatior `allowExtraFields` and `allowMissingFields` parameters can be overwritten with annotations:

```
use Flavacaster\SymfonyValidatorsBundle\Options\AllowExtraFields;
use Flavacaster\SymfonyValidatorsBundle\Options\AllowMissingFields;

/**
 * @AllowExtraFields
 * @AllowMissingFields
 */
final class Request implements RequestPayloadInterface
{

}
```

🥔

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 58.1% 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 ~35 days

Recently: every ~102 days

Total

20

Last Release

1249d ago

PHP version history (5 changes)v1.0.0PHP ^7.0

v1.0.9PHP ^7.4

v1.0.10PHP ^7.4|^8.0

v1.0.17PHP ^7.4|^8.1

v1.0.20PHP ^8.1

### Community

Maintainers

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

---

Top Contributors

[![nope7777](https://avatars.githubusercontent.com/u/8977306?v=4)](https://github.com/nope7777 "nope7777 (18 commits)")[![flavacaster](https://avatars.githubusercontent.com/u/54861683?v=4)](https://github.com/flavacaster "flavacaster (12 commits)")[![Zuken](https://avatars.githubusercontent.com/u/3996877?v=4)](https://github.com/Zuken "Zuken (1 commits)")

### Embed Badge

![Health badge](/badges/flavacaster-symfony-http-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/flavacaster-symfony-http-bundle/health.svg)](https://phpackages.com/packages/flavacaster-symfony-http-bundle)
```

###  Alternatives

[sylius/sylius

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

8.4k5.6M648](/packages/sylius-sylius)[sulu/sulu

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

1.3k1.3M152](/packages/sulu-sulu)[nelmio/api-doc-bundle

Generates documentation for your REST API from attributes

2.3k63.6M232](/packages/nelmio-api-doc-bundle)[api-platform/core

Build a fully-featured hypermedia or GraphQL API in minutes!

2.6k48.1M236](/packages/api-platform-core)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[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)

PHPackages © 2026

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