PHPackages                             devouted/request-mapper - 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. devouted/request-mapper

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

devouted/request-mapper
=======================

Symfony attributes for mapping HTTP request headers, path parameters and uploaded files to object constructor parameters

v1.2.1(2mo ago)03MITPHPPHP &gt;=8.2

Since Apr 10Pushed 2mo agoCompare

[ Source](https://github.com/devouted/request-mapper)[ Packagist](https://packagist.org/packages/devouted/request-mapper)[ RSS](/packages/devouted-request-mapper/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (6)Versions (6)Used By (0)

Request Mapper
==============

[](#request-mapper)

[![PHP Version](https://camo.githubusercontent.com/d840cef9807c8f76051ad687841d67f4d830c84e0d83236968e53124ef6742d5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e322d3838393242462e737667)](https://php.net/)[![Tested on PHP 8.5](https://camo.githubusercontent.com/31a3a4884bb58354a86a37deb8707fdb08e2f6e0ed51cec3da3dd3a9ddca86d0/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7465737465642532306f6e2d504850253230382e32253230253743253230382e33253230253743253230382e34253230253743253230382e352d627269676874677265656e2e737667)](https://php.net/)[![Symfony](https://camo.githubusercontent.com/8dce52e3c6389b7772d93d379f67944be4406eb5f74a823df409fff36203c0f9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73796d666f6e792d362e34253230253743253230372e78253230253743253230382e782d626c61636b2e737667)](https://symfony.com/)[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)

Symfony attributes for mapping HTTP request headers, path parameters and uploaded files to object constructor parameters via the Serializer denormalization pipeline.

Requirements
------------

[](#requirements)

- PHP &gt;= 8.2 (tested on 8.2, 8.3, 8.4, 8.5)
- Symfony 6.4, 7.x or 8.x

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

[](#installation)

```
composer require devouted/request-mapper
```

Usage
-----

[](#usage)

Mark constructor parameters with attributes to indicate their source:

```
use RequestMapper\Attribute\FromHeader;
use RequestMapper\Attribute\FromPath;
use RequestMapper\Attribute\FromUploads;

class GetArticleQuery
{
    public function __construct(
        #[FromPath]
        public int $articleId,

        #[FromHeader(name: 'Accept-Language')]
        public string $language,
    ) {
    }
}

class UploadFileCommand
{
    public function __construct(
        #[FromPath]
        public int $visitId,

        #[FromUploads]
        public array $files = [],
    ) {
    }
}
```

### Attributes

[](#attributes)

AttributeSourceExample`#[FromHeader]`HTTP request header`#[FromHeader(name: 'X-Token')]``#[FromPath]`Route parameter`#[FromPath(name: 'id')]``#[FromUploads]`Uploaded files (`$_FILES`)`#[FromUploads]`All attributes accept optional `name` (defaults to parameter name) and `required` (defaults to `true`).

`#[FromPath]` automatically casts values to the parameter's PHP type (`int`, `float`, `bool`, `string`).

Value Resolver
--------------

[](#value-resolver)

The bundle includes `RequestMapperValueResolver` which integrates with Symfony's `#[MapQueryString]` and `#[MapRequestPayload]` attributes. This solves the problem where Symfony's default resolver skips mapping entirely when the query string or request body is empty — preventing `FromHeader`, `FromPath` and `FromUploads` attributes from being processed.

```
use RequestMapper\Attribute\FromHeader;
use RequestMapper\Attribute\FromPath;
use Symfony\Component\HttpKernel\Attribute\MapQueryString;

class ArticleController
{
    public function show(#[MapQueryString] GetArticleQuery $query): Response
    {
        // Works even when the query string is empty —
        // FromPath and FromHeader attributes are still resolved.
    }
}
```

The resolver requires `symfony/http-kernel` and `symfony/validator`.

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

[](#configuration)

If Symfony autoconfiguration is enabled, the denormalizer and value resolver are registered automatically. Otherwise register them manually:

```
# config/services.yaml
services:
    RequestMapper\Serializer\RequestMapperDenormalizer:
        tags: ['serializer.normalizer']

    RequestMapper\ArgumentResolver\RequestMapperValueResolver:
        tags: ['controller.argument_value_resolver']
```

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance88

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

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 ~0 days

Total

5

Last Release

60d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/30835882?v=4)[devouted](/maintainers/devouted)[@devouted](https://github.com/devouted)

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/devouted-request-mapper/health.svg)

```
[![Health](https://phpackages.com/badges/devouted-request-mapper/health.svg)](https://phpackages.com/packages/devouted-request-mapper)
```

###  Alternatives

[api-platform/core

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

2.6k50.1M306](/packages/api-platform-core)[symfony/http-kernel

Provides a structured process for converting a Request into a Response

8.1k853.6M8.2k](/packages/symfony-http-kernel)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

21764.8M1.6k](/packages/drupal-core)[sulu/sulu

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

1.3k1.4M195](/packages/sulu-sulu)[api-platform/symfony

Symfony API Platform integration

354.0M107](/packages/api-platform-symfony)[api-platform/state

API Platform state interfaces

244.3M111](/packages/api-platform-state)

PHPackages © 2026

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