PHPackages                             tomschlick/request-migrations - 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. tomschlick/request-migrations

ActiveLibrary[HTTP &amp; Networking](/categories/http)

tomschlick/request-migrations
=============================

HTTP Request Migrations

v0.5.0(7y ago)1844.5k12[4 issues](https://github.com/tomschlick/request-migrations/issues)MITPHPPHP ^7.1CI passing

Since Aug 18Pushed 4y ago5 watchersCompare

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

READMEChangelog (10)Dependencies (8)Versions (12)Used By (0)

HTTP Request Migrations
=======================

[](#http-request-migrations)

[![Latest Version on Packagist](https://camo.githubusercontent.com/08bc02b3e8f9554b41626a4edaa2e4855f09831ffdede2d362551ab59057f0c8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f6d7363686c69636b2f726571756573742d6d6967726174696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tomschlick/request-migrations)[![Build Status](https://camo.githubusercontent.com/2c747607123465e23813554dcead9e70ff9f9d82034417f62abeed9633406845/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f746f6d7363686c69636b2f726571756573742d6d6967726174696f6e732f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/tomschlick/request-migrations)[![Total Downloads](https://camo.githubusercontent.com/9e2080bd79ae981fea719d826056e65dd18cbebccdb355a4b6573d6f33ceafa6/68747470733a2f2f706f7365722e707567782e6f72672f746f6d7363686c69636b2f726571756573742d6d6967726174696f6e732f646f776e6c6f616473)](https://packagist.org/packages/tomschlick/request-migrations)[![StyleCI](https://camo.githubusercontent.com/644b7579e7290af4bd4e60c01d97f2e191433fb267b170053d37129e0f601531/68747470733a2f2f7374796c6563692e696f2f7265706f732f3130303430383130382f736869656c64)](https://styleci.io/repos/100408108)

This package is based on the [API versioning scheme used at Stripe](https://stripe.com/blog/api-versioning). Users pass a version header and you automatically migrate the request &amp; response data to match the current version of your code.

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

[](#installation)

You can install the package via composer:

### Installation via Composer

[](#installation-via-composer)

```
composer require tomschlick/request-migrations
```

### Service Provider &amp; Facade

[](#service-provider--facade)

This package supports Laravel 5.5 autoloading so the service provider and facade will be loaded automatically.

If you are using an earlier version of Laravel or have autoloading disabled you need to add the service provider and facade to `config/app.php`.

```
'providers' => [
    \TomSchlick\RequestMigrations\RequestMigrationsServiceProvider.php,
]
```

```
'aliases' => [
    'RequestMigrations' => \TomSchlick\RequestMigrations\Facades\RequestMigrations::class,
]
```

### Middleware

[](#middleware)

Add the middleware to your Http Kernel `app/Http/Kernel.php`.

```
protected $middleware = [
	\TomSchlick\RequestMigrations\RequestMigrationsMiddleware::class,
];
```

### Configuration

[](#configuration)

Run the following Artisan command to publish the package configuration to `config/request-migrations.php`.

```
php artisan vendor:publish --provider="TomSchlick\RequestMigrations\RequestMigrationsServiceProvider"
```

Usage
-----

[](#usage)

### Creating a Migration

[](#creating-a-migration)

You can generate a new request migration using the Artisan CLI.

```
php artisan make:request-migration ExampleMigration
```

The command will generate a request migration and publish it to `App/Http/Migrations/*`.

It will generate a migration, you can modify it like this:

```
class GroupNameMigration extends RequestMigration
{
    /**
     * Migrate the request for the application to "read".
     *
     * @param \Illuminate\Http\Request $request
     *
     * @return \Illuminate\Http\Request
     */
    public function migrateRequest(Request $request) : Request
    {
        return $request;
    }

    /**
     * Migrate the response to display to the client.
     *
     * @param \Symfony\Component\HttpFoundation\Response $response
     *
     * @return \Symfony\Component\HttpFoundation\Response
     */
    public function migrateResponse(Response $response) : Response
    {
        $content = json_decode($response->getContent(), true);

        $content['firstname'] = array_get($content, 'name.firstname');
        $content['lastname'] = array_get($content, 'name.lastname');
        unset($content['name']);

        return $response->setContent(json_encode($content));
    }

    /**
     * Define which named paths should this migration modify.
     *
     * @return array
     */
    public function paths() : array
    {
        return [
            'users/show',
        ];
    }
}
```

### Override the Versions

[](#override-the-versions)

```
use TomSchlick\RequestMigrations\Facades\RequestMigrations;

// set both response & request versions
RequestMigrations::setVersion('2017-01-01')

// set the request version
RequestMigrations::setRequestVersion('2017-01-01')

// set the response version
RequestMigrations::setResponseVersion('2017-01-01')
```

This can be useful if you are pinning the version to a user.

```
RequestMigrations::setVersion(auth()->user()->api_version);
```

Changelog
---------

[](#changelog)

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

Testing
-------

[](#testing)

```
composer test
```

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

[](#contributing)

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

Security
--------

[](#security)

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

License
-------

[](#license)

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

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

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

Recently: every ~114 days

Total

11

Last Release

2609d ago

PHP version history (2 changes)v0.1.0PHP ^7.0

v0.5.0PHP ^7.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/70184?v=4)[Tom Schlick](/maintainers/tomschlick)[@tomschlick](https://github.com/tomschlick)

---

Top Contributors

[![tomschlick](https://avatars.githubusercontent.com/u/70184?v=4)](https://github.com/tomschlick "tomschlick (70 commits)")[![sixlive](https://avatars.githubusercontent.com/u/5108034?v=4)](https://github.com/sixlive "sixlive (27 commits)")[![jbrooksuk](https://avatars.githubusercontent.com/u/246103?v=4)](https://github.com/jbrooksuk "jbrooksuk (4 commits)")[![vistik](https://avatars.githubusercontent.com/u/354169?v=4)](https://github.com/vistik "vistik (2 commits)")[![mbaeuerle](https://avatars.githubusercontent.com/u/1345394?v=4)](https://github.com/mbaeuerle "mbaeuerle (1 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (1 commits)")[![cmgmyr](https://avatars.githubusercontent.com/u/4693481?v=4)](https://github.com/cmgmyr "cmgmyr (1 commits)")

---

Tags

httplaravelmiddlewaremigrationsphpphp7requestshttpmiddlewarelaravelmigrationsrequestsrequest-migrations

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tomschlick-request-migrations/health.svg)

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k14.1M124](/packages/laravel-pulse)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9772.3M122](/packages/roots-acorn)[api-platform/laravel

API Platform support for Laravel

59156.3k11](/packages/api-platform-laravel)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77018.2M124](/packages/laravel-mcp)[aedart/athenaeum

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

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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