PHPackages                             pine3ree/p3-mezzio-controller - 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. [Framework](/categories/framework)
4. /
5. pine3ree/p3-mezzio-controller

ActiveLibrary[Framework](/categories/framework)

pine3ree/p3-mezzio-controller
=============================

A middleware wrapper for controller-like classes for mezzio/mezzio

0.2.5(6y ago)010BSD-3-ClausePHPPHP ^7.1CI failing

Since Apr 20Pushed 6y ago1 watchersCompare

[ Source](https://github.com/pine3ree/p3-mezzio-controller)[ Packagist](https://packagist.org/packages/pine3ree/p3-mezzio-controller)[ Docs](https://github.com/pine3ree/p3-mezzio-controller)[ RSS](/packages/pine3ree-p3-mezzio-controller/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (11)Versions (10)Used By (0)

p3-mezzio-controller
====================

[](#p3-mezzio-controller)

[![Build Status](https://camo.githubusercontent.com/8a4aa59a20e7e3246c3d604927c6829fe528c5e4046a016d5c54c9bb5e934120/68747470733a2f2f7472617669732d63692e6f72672f70696e65337265652f70332d6d657a7a696f2d636f6e74726f6c6c65722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/pine3ree/p3-mezzio-controller)

*A middleware wrapper for controller-like classes for mezzio/mezzio*

#### STATUS

[](#status)

WIP!

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

[](#installation)

You can install this library using Composer (with "minimum-stability": "dev"):

```
$ composer require pine3ree/p3-mezzio-controller
```

Documentation
-------------

[](#documentation)

You can now define 2 new types of route handled by generic-class controller methods:

Define a route using the callable-string format:

```
$app->get('/home/kitchen', 'App\Controller\Home::kitchen', 'home/kitchen');
```

Define a route using the callable-array format:

```
use App\Controller\Home;
//...
$app->get('/home/bedroom', [Home::class, 'bedroom'], 'home/bedroom');
```

Define routes using a configuration file:

```
// config/autoload/routes.global.php

use App\Controller\Home;
use App\Middleware\BeforeHomeControllerMiddleware;
use App\Middleware\AfterHomeControllerMiddleware;

return [
    'routes' => [
        'home/kitchen' => [
            'path' => '/home/kitchen',
            'middleware' => 'App\Controller\Home::kitchen',
        ],
        'home/bedroom' => [
            'path' => '/home/kitchen',
            'middleware' => [Home::class, 'bedroom'],
        ],
        'home/living-room' => [
            'path' => '/home/living-room',
            'middleware' => [
                BeforeHomeControllerMiddleware::class,
                [Home::class, 'livingRoom'],
                AfterHomeControllerMiddleware::class,
            ],
        ],
    ],
];
```

These definitions works only on the condition that if the controller class exists and the target method is public.

As of now the target controller-method signature may be one of the following:

```
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;

class Home
{
    public function kitchen(ServerRequestInterface $request): ResponseInterface
    {
        // return a response
    }

    public function bedroom(): ResponseInterface
    {
        // return a response
    }
}
```

The controller class may be a simple contructor-less class. In most of cases it will have dependencies so it muste me defined in the container configuration along with its factory.

#### TODO:

[](#todo)

- Add strategy to pass request attributes as arguments into the target controller-method
- Add strategy to allow null, string, array, xml, etc... return values from the controller-methods and build appropriate response based on the return type.

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

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

Total

9

Last Release

2238d ago

### Community

Maintainers

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

---

Top Contributors

[![pine3ree](https://avatars.githubusercontent.com/u/3229979?v=4)](https://github.com/pine3ree "pine3ree (31 commits)")

---

Tags

middlewareroutingpsr-15mezziocontrollerpine3reep3

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/pine3ree-p3-mezzio-controller/health.svg)

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

###  Alternatives

[symfony/symfony

The Symfony PHP framework

31.4k87.2M2.2k](/packages/symfony-symfony)[cakephp/cakephp

The CakePHP framework

8.9k19.5M1.8k](/packages/cakephp-cakephp)[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k14](/packages/tempest-framework)[mezzio/mezzio

PSR-15 Middleware Microframework

3923.8M124](/packages/mezzio-mezzio)[spiral/framework

Spiral, High-Performance PHP/Go Framework

2.1k2.2M66](/packages/spiral-framework)

PHPackages © 2026

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