PHPackages                             shetabit/transform-request - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. shetabit/transform-request

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

shetabit/transform-request
==========================

Transform laravel requests

v2.0(yesterday)17MITPHPPHP ^8.4

Since Aug 27Pushed 6y ago2 watchersCompare

[ Source](https://github.com/shetabit/transform-request)[ Packagist](https://packagist.org/packages/shetabit/transform-request)[ Docs](https://github.com/shetabit/transform-request)[ RSS](/packages/shetabit-transform-request/feed)WikiDiscussions master Synced yesterday

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

 [![](resources/images/diagram.png?raw=true)](resources/images/diagram.png?raw=true)

Transform laravel requests
==========================

[](#transform-laravel-requests)

you can **normalize** or **change request data structure** with transformers.

> lets **normalize** our data in `transformers` and let `controllers` to be much more **cleaner** and **smaller**.

List of contents
----------------

[](#list-of-contents)

- [Install](#install)
- [How to use](#how-to-use)
    - [Create a new data transformer](#create-a-new-data-transformer)
    - [Transform requests](#transform-requests)
- [Change log](#change-log)
- [Contributing](#contributing)
- [Security](#security)
- [Credits](#credits)
- [License](#license)

Install
-------

[](#install)

Via Composer

```
$ composer require shetabit/transform-request
```

How to use
----------

[](#how-to-use)

#### Create a new data transformer

[](#create-a-new-data-transformer)

> we use transformers to transform request data.

you can run the below command in your console in order to create a new data transformer named `TestTransformer`.

```
$ composer php artisan make:transformer TestTransformer
```

all transformers will be created in `App\Http\Transformers` path.

#### Transformer example:

[](#transformer-example)

in all transformers, the `transform` method will transform your data into your ideal one. for example we can write the below code in it:

```
namespace App\Http\Transformers;

use Shetabit\Transformer\Contracts\TransformerInterface;

class TestTransformer implements TransformerInterface
{
    /**
     * transform given data
     *
     * @param array $data
     * @return array
     */
    public function transform(array $data) : array {
        /*
            input data :
            [
                'n' => 'mahdi',
                'f' => 'khanzadi'
            ]

            transformed data:
            [
                'name' => 'mahdi',
                'family' => 'khanzadi',
                'username' => 'mahdikhanzadi'
            ]
        */

        return [
            'name' => $data['n'] ?? null,
            'family' => $data['f'] ?? null,
            'username' => ($data['n'] ?? null).($data['f'] ?? null)
        ];
    }
}
```

#### Transform requests

[](#transform-requests)

we can use a transformer to transform requests like the below:

```
namespace App\Http\Controllers;

use App\Http\Transformers\TestTransformer;
use Illuminate\Http\Request;

class TestController extends Controller
{
    public function __invoke(Request $request) {
        $data = $request->transform()->get(new TestTransformer());

        print_r($data)
    }
}
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Mahdi khanzadi](https://github.com/khanzadimahdi)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance55

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity78

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

Total

2

Last Release

1d ago

Major Versions

v1.0 → v2.02026-08-17

PHP version history (2 changes)v1.0PHP &gt;=7.2

v2.0PHP ^8.4

### Community

Maintainers

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

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

---

Top Contributors

[![roshedgostarandev1](https://avatars.githubusercontent.com/u/52368299?v=4)](https://github.com/roshedgostarandev1 "roshedgostarandev1 (8 commits)")

---

Tags

shetabitrequest transformertransform laravel requestsmodify laravel request key nameslaravel request transformer

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/shetabit-transform-request/health.svg)

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

###  Alternatives

[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

79227.1M228](/packages/laravel-mcp)[mike-bronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k161.4k2](/packages/mike-bronner-laravel-model-caching)[forjedio/inertia-table

Backend-driven dynamic tables for Laravel + Inertia.js

272.0k](/packages/forjedio-inertia-table)[spatie/laravel-export

Create a static site bundle from a Laravel app

679153.2k7](/packages/spatie-laravel-export)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

265.2k](/packages/aedart-athenaeum)[zidbih/laravel-deadlock

Make temporary Laravel workarounds expire and fail CI when ignored.

1007.4k](/packages/zidbih-laravel-deadlock)

PHPackages © 2026

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