PHPackages                             mezzio/mezzio-migration - 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. [Database &amp; ORM](/categories/database)
4. /
5. mezzio/mezzio-migration

ActiveLibrary[Database &amp; ORM](/categories/database)

mezzio/mezzio-migration
=======================

Migrate Mezzio applications from v2 to v3

1.4.0(1y ago)337.5k↓34.8%4[1 issues](https://github.com/mezzio/mezzio-migration/issues)[4 PRs](https://github.com/mezzio/mezzio-migration/pulls)BSD-3-ClausePHPPHP ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0CI passing

Since Dec 31Pushed 1mo ago10 watchersCompare

[ Source](https://github.com/mezzio/mezzio-migration)[ Packagist](https://packagist.org/packages/mezzio/mezzio-migration)[ Docs](https://mezzio.dev)[ Fund](https://funding.communitybridge.org/projects/laminas-project)[ RSS](/packages/mezzio-mezzio-migration/feed)WikiDiscussions 1.5.x Synced 1mo ago

READMEChangelog (6)Dependencies (5)Versions (23)Used By (0)

mezzio-migration
================

[](#mezzio-migration)

[![Build Status](https://github.com/mezzio/mezzio-migration/actions/workflows/continuous-integration.yml/badge.svg)](https://github.com/mezzio/mezzio-migration/actions/workflows/continuous-integration.yml)

> ## 🇷🇺 Русским гражданам
>
> [](#-русским-гражданам)
>
> Мы, участники Laminas, родились и живем в разных странах. У многих из нас есть друзья, родственники и коллеги как в России, так и в Украине. Некоторые из нас родились в России. Некоторые из нас живут в России. У некоторых бабушки и дедушки сражались с фашистами во Второй мировой войне. Здесь никто не поддерживает фашизм.
>
> У одного из нас есть украинская родственница, которая спаслась из дома вместе с сыном. Поезд задержался из-за бомбежки на дороге впереди. У нас есть друзья, которые прячутся в бомбоубежищах. Мы с тревогой ждем весточки от них после воздушных налетов, которые беспорядочно наносят удары и попадают по больницам, школам, детским садам и домам. Мы не берем это из каких-либо СМИ. Мы наблюдаем это напрямую.
>
> Вы доверяете нам достаточно, чтоб использовать наши программы, и мы просим вас довериться нам вновь. Мы нуждаемся в помощи. Выходите и протестуйте против этой бесполезной войны. Остановите кровопролитие. Скажите "Нет войне!"
>
> ## 🇺🇸 To Citizens of Russia
>
> [](#-to-citizens-of-russia)
>
> We at Laminas come from all over the world. Many of us have friends, family and colleagues in both Russia and Ukraine. Some of us were born in Russia. Some of us currently live in Russia. Some have grandparents who fought Nazis in World War II. Nobody here supports fascism.
>
> One team member has a Ukrainian relative who fled her home with her son. The train was delayed due to bombing on the road ahead. We have friends who are hiding in bomb shelters. We anxiously follow up on them after the air raids, which indiscriminately fire at hospitals, schools, kindergartens and houses. We're not taking this from any media. These are our actual experiences.
>
> You trust us enough to use our software. We ask that you trust us to say the truth on this. We need your help. Go out and protest this unnecessary war. Stop the bloodshed. Say "stop the war!"

This library provides a tool for migrating from Mezzio v2 to v3.

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

[](#installation)

Run the following to install this library:

```
$ composer require --dev mezzio/mezzio-migration
```

Usage
-----

[](#usage)

Once you have installed the tool, execute it with the following:

```
$ ./vendor/bin/mezzio-migration migrate
```

> ### Cloning versus composer installation
>
> [](#cloning-versus-composer-installation)
>
> If you'd rather clone the tooling once and re-use it many times, you can do that instead. Clone using:
>
> ```
> $ git clone https://github.com/mezzio/mezzio-migration
> ```
>
>
>
> And then, instead of using `./vendor/bin/mezzio-migration migrate`, use `/full/path/to/mezzio-migration/bin/mezzio-migration`.

> **TODO:**
>
> Our goal is to prepare a downloadable [phar](http://php.net/phar) file that can be installed in your system and re-used; this change will come at a future date.

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

[](#requirements)

All external packages used within your project must be compatible with Mezzio v3 libraries. If you are unsure, check their dependencies.

This script will uninstall all dependent packages and then will try to install them with the latest compatible version. In case any package is not compatible, the script will report an error indicating which package need to be updated.

The following table indicates Mezzio package versions compatible with version 3, and to which the migration tool will update.

Package nameVersionlaminas-auradi-config1.0.0laminas-component-installer2.1.0laminas-config-aggregator1.1.0laminas-diactoros1.7.1mezzio3.0.0mezzio-aurarouter3.0.0mezzio-authentication0.4.0mezzio-authentication-basic0.3.0mezzio-authentication-oauth20.4.0mezzio-authentication-session0.4.0mezzio-authentication-laminasauthentication0.4.0mezzio-authorization0.4.0mezzio-authorization-acl0.3.0mezzio-authorization-rbac0.3.0mezzio-csrf1.0.0mezzio-fastroute3.0.0mezzio-flash1.0.0mezzio-hal1.0.0mezzio-helpers5.0.0mezzio-platesrenderer2.0.0mezzio-router3.0.0mezzio-session1.0.0mezzio-session-ext1.0.0mezzio-template2.0.0mezzio-tooling1.0.0mezzio-twigrenderer2.0.0mezzio-laminasrouter3.0.0mezzio-laminasviewrenderer2.0.0laminas-httphandlerrunner1.0.1laminas-pimple-config1.0.0mezzio-problem-details1.0.0laminas-stratigility3.0.0What does the tool do?
----------------------

[](#what-does-the-tool-do)

In order to operate, the tool requires that the application directory contains a `composer.json` file, and that this file is writable by the script.

Next, it attempts to detect the currently used Mezzio version. If the version detected is not a 2.X version, the script will exit without performing any changes.

It then performs the following steps:

1. Removes the `vendor` directory.
2. Installs current dependencies using `composer install`.
3. Analyzes `composer.lock` to identify all packages which depends on Mezzio packages.
4. Removes all installed Mezzio packages and packages that depend on them.
5. Updates all remaining packages using `composer update`.
6. Requires all Mezzio packages previously installed, adding the packages `laminas/laminas-component-installer` and `mezzio/mezzio-tooling`as development packages if they were not previously installed.
7. Requires all packages installed previously that were dependent on Mezzio. **This step may fail** in situations where external packages are not yet compatible with Mezzio v3 or its required libraries.
8. Updates `config/pipeline.php`:

    1. adds strict type declarations to the top of the file;
    2. adds a function wrapper (as is done in the version 3 skeleton);
    3. updates the following middleware:
        - `pipeRoutingMiddleware` becomes a `pipe()` statement referencing `Mezzio\Router\Middleware\RouteMiddleware`.
        - `pipeDispatchMiddleware` becomes a `pipe()` statement referencing `Mezzio\Router\Middleware\DispatchMiddleware`,
        - References to `Mezzio\Middleware\NotFoundHandler` become `Mezzio\Handler\NotFoundHandler`,
        - References to `Mezzio\Middleware\ImplicitHeadMiddleware` become `Mezzio\Router\Middleware\ImplicitHeadMiddleware`,
        - References to `Mezzio\Middleware\ImplicitOptionsMiddleware` become `Mezzio\Router\Middleware\ImplicitOptionsMiddleware`,
    4. pipes `Mezzio\Router\Middleware\MethodNotAllowedMiddleware` after `Implicit*Middleware` (or if these are not piped, after `Mezzio\Router\Middleware\RouteMiddleware`).
9. Updates `config/routes.php`:

    1. adds strict type declaration on top of the file;
    2. adds a function wrapper (as is done in the version 3 skeleton).
10. Replaces `public/index.php` with the latest version from the v3 skeleton.
11. Updates container configuration if `pimple` or `Aura.Di` were used (`config/container.php`) from the latest skeleton version. Additionally, it does the following:

    - For `pimple`: the package `xtreamwayz/pimple-container-interop` is replaced by `laminas/laminas-pimple-config`.
    - For `Aura.Di`: the package `aura/di` is replaced by `laminas/laminas-auradi-config`.
12. Migrates http-interop middleware to PSR-15 middleware using `./vendor/bin/mezzio migrate:interop-middleware`.
13. Migrates PSR-15 middleware to PSR-15 request handlers using `./vendor/bin/mezzio migrate:middleware-to-request-handler`.
14. Runs `./vendor/bin/phpcbf` if it is available.

What should you do after migration?
-----------------------------------

[](#what-should-you-do-after-migration)

You will need to update your tests to use PSR-15 middleware instead of http-interop middleware. This step is not done automatically because *it is too complicated*. We can easily change imported classes, but unfortunately test strategies and mocking strategies vary widely, and detecting all http-interop variants makes this even more difficult.

Please manually compare and verify all changes made. It is possible that in some edge cases, the script will not work correctly. This will depend primarily on the number of modifications you have made to the original skeleton.

> ### Configuration-driven pipelines and routes
>
> [](#configuration-driven-pipelines-and-routes)
>
> The script does not work currently make any modifications to pipeline and route configuration; these will need to be updated manually.

###  Health Score

53

—

FairBetter than 97% of packages

Maintenance59

Moderate activity, may be stable

Popularity33

Limited adoption so far

Community22

Small or concentrated contributor base

Maturity84

Battle-tested with a long release history

 Bus Factor1

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

Recently: every ~306 days

Total

18

Last Release

57d ago

Major Versions

0.1.x-dev → 1.0.02021-05-14

PHP version history (7 changes)0.1.0PHP ^7.1

0.1.5PHP ^7.3

1.0.0PHP ^7.3 || ~8.0.0

1.1.0PHP ^7.3 || ~8.0.0 || ~8.1.0

1.2.0PHP ^7.4 || ~8.0.0 || ~8.1.0

1.3.0PHP ~8.0.0 || ~8.1.0 || ~8.2.0

1.4.0PHP ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/25943?v=4)[Matthew Weier O'Phinney](/maintainers/weierophinney)[@weierophinney](https://github.com/weierophinney)

![](https://avatars.githubusercontent.com/u/296074?v=4)[Zend Framework](/maintainers/zendframework)[@zendframework](https://github.com/zendframework)

---

Top Contributors

[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (107 commits)")[![michalbundyra](https://avatars.githubusercontent.com/u/7423207?v=4)](https://github.com/michalbundyra "michalbundyra (46 commits)")[![weierophinney](https://avatars.githubusercontent.com/u/25943?v=4)](https://github.com/weierophinney "weierophinney (14 commits)")[![gsteel](https://avatars.githubusercontent.com/u/2803720?v=4)](https://github.com/gsteel "gsteel (11 commits)")[![ghostwriter](https://avatars.githubusercontent.com/u/9754361?v=4)](https://github.com/ghostwriter "ghostwriter (11 commits)")[![jslmorrison](https://avatars.githubusercontent.com/u/6794810?v=4)](https://github.com/jslmorrison "jslmorrison (8 commits)")[![Ocramius](https://avatars.githubusercontent.com/u/154256?v=4)](https://github.com/Ocramius "Ocramius (6 commits)")[![boesing](https://avatars.githubusercontent.com/u/2189546?v=4)](https://github.com/boesing "boesing (5 commits)")[![geerteltink](https://avatars.githubusercontent.com/u/9497586?v=4)](https://github.com/geerteltink "geerteltink (4 commits)")[![samsonasik](https://avatars.githubusercontent.com/u/459648?v=4)](https://github.com/samsonasik "samsonasik (1 commits)")[![Xerkus](https://avatars.githubusercontent.com/u/725842?v=4)](https://github.com/Xerkus "Xerkus (1 commits)")

---

Tags

hacktoberfestlaminasmigrationmezzio

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/mezzio-mezzio-migration/health.svg)

```
[![Health](https://phpackages.com/badges/mezzio-mezzio-migration/health.svg)](https://phpackages.com/packages/mezzio-mezzio-migration)
```

###  Alternatives

[doctrine/doctrine-orm-module

Laminas Module that provides Doctrine ORM functionality

4407.3M293](/packages/doctrine-doctrine-orm-module)[ssch/typo3-rector

Instant fixes for your TYPO3 PHP code by using Rector.

2592.8M263](/packages/ssch-typo3-rector)[doctrine/doctrine-module

Laminas Module that provides Doctrine basic functionality required for ORM and ODM modules

3957.9M116](/packages/doctrine-doctrine-module)[rector/rector-src

Instant Upgrade and Automated Refactoring of any PHP code

134391.5k12](/packages/rector-rector-src)[doctrine/doctrine-mongo-odm-module

Laminas Module which provides Doctrine MongoDB ODM functionality

86676.6k35](/packages/doctrine-doctrine-mongo-odm-module)[samsonasik/error-hero-module

A Hero for your Laminas and Mezzio application to trap php errors &amp; exceptions

5233.4k1](/packages/samsonasik-error-hero-module)

PHPackages © 2026

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