PHPackages                             bilyiv/request-data-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. bilyiv/request-data-bundle

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

bilyiv/request-data-bundle
==========================

Represents request data in a structured and useful way.

v1.3.0(7y ago)202.6k4[1 issues](https://github.com/bilyiv/request-data-bundle/issues)MITPHPPHP ^7.2

Since Feb 2Pushed 6y ago2 watchersCompare

[ Source](https://github.com/bilyiv/request-data-bundle)[ Packagist](https://packagist.org/packages/bilyiv/request-data-bundle)[ RSS](/packages/bilyiv-request-data-bundle/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (8)Dependencies (7)Versions (9)Used By (0)

Request data bundle
===================

[](#request-data-bundle)

This bundle allows you to represent request data in a structured and useful way by creating request data classes.

**Features**:

- Detecting how to extract data depends on request method and `Content-Type` header.
- Representing and normalizing query parameters for the `GET` request method.
- Representing `form`, `json`, `xml` request body for the `POST`, `PUT`, `PATCH` request methods.
- Defining supported formats and throwing exception if the request format is unsupported.
- Dispatching the finish event when request data is ready.

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

[](#installation)

Run the following command using [Composer](http://packagist.org):

```
composer require bilyiv/request-data-bundle
```

Configuration
-------------

[](#configuration)

The default configuration is the following:

```
request_data:
    prefix: App\RequestData
```

Usage
-----

[](#usage)

#### Create a request data class

[](#create-a-request-data-class)

```
namespace App\RequestData;

class PostRequestData implements FormatSupportableInterface
{
    public const DEFAULT_AUTHOR = 'none';

    /**
     * @var string
     */
    public $title;

    /**
     * @var string
     */
    public $author = self::DEFAULT_AUTHOR;

    /**
     * {@inheritdoc}
     */
    public static function getSupportedFormats(): array
    {
        return [Formats::FORM, Formats::JSON, Formats::XML];
    }
}
```

#### Use it in your controller

[](#use-it-in-your-controller)

```
namespace App\Controller;

class PostController extends AbstractController
{
    /**
     * @Route("/", name="action")
     */
    public function action(PostRequestData $data)
    {
       return new JsonResponse($data);
    }
}
```

#### Make requests

[](#make-requests)

All the following requests will return the same json response:

```
{
    "title": "Hamlet",
    "author": "William Shakespeare"
}
```

`GET` request:

```
curl -X GET 'https://example.com?title=Hamlet&author=William+Shakespeare'
```

`POST` form request:

```
curl -X POST 'https://example.com' \
     -H 'Content-Type: application/x-www-form-urlencoded' \
     -d 'title=Hamlet&author=William+Shakespeare'
```

`POST` json request:

```
curl -X POST 'https://example.com' \
     -H 'Content-Type: application/json' \
     -d '{"title":"Hamlet","author":"William Shakespeare"}'
```

`POST` xml request:

```
curl -X POST 'https://example.com' \
     -H 'Content-Type: application/xml' \
     -d 'HamletWilliam Shakespeare'
```

`POST` csv request throws an exception because of unsupported format:

```
curl -X POST 'https://example.com' \
     -H 'Content-Type: application/csv' \
     -d 'Hamlet,William Shakespeare'
```

License
-------

[](#license)

This bundle is released under the MIT license. See the included [LICENSE](LICENSE) file for more information.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

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

Total

8

Last Release

2609d ago

PHP version history (2 changes)v1.0.0-beta.1PHP ^7.1.3

v1.1.3-beta.1PHP ^7.2

### Community

Maintainers

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

---

Top Contributors

[![bilyiv](https://avatars.githubusercontent.com/u/16577983?v=4)](https://github.com/bilyiv "bilyiv (94 commits)")

---

Tags

requestjsonapirestdata

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/bilyiv-request-data-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/bilyiv-request-data-bundle/health.svg)](https://phpackages.com/packages/bilyiv-request-data-bundle)
```

###  Alternatives

[nelmio/api-doc-bundle

Generates documentation for your REST API from attributes

2.3k63.6M233](/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)[sylius/sylius

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

8.4k5.6M651](/packages/sylius-sylius)[lexik/jwt-authentication-bundle

This bundle provides JWT authentication for your Symfony REST API

2.6k58.7M210](/packages/lexik-jwt-authentication-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)

PHPackages © 2026

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