PHPackages                             bitexpert/prophiler-psr7-middleware - 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. bitexpert/prophiler-psr7-middleware

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

bitexpert/prophiler-psr7-middleware
===================================

PSR-7 middleware for Prophiler

v0.6.0(8y ago)79.8k↓50%5[1 issues](https://github.com/bitExpert/prophiler-psr7-middleware/issues)1Apache-2.0PHPPHP ^7.0

Since Oct 18Pushed 8y ago10 watchersCompare

[ Source](https://github.com/bitExpert/prophiler-psr7-middleware)[ Packagist](https://packagist.org/packages/bitexpert/prophiler-psr7-middleware)[ RSS](/packages/bitexpert-prophiler-psr7-middleware/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (10)Versions (18)Used By (1)

prophiler-psr7-middleware
=========================

[](#prophiler-psr7-middleware)

This package provides a slim PSR-7 middleware implementation based on the zendframework/zend-stratigility package. The middleware is responsible for "adding" the Prophiler Toolbar output to the Response object.

[![Build Status](https://camo.githubusercontent.com/c609776d699e659a481a5c773c06531b60a5f6c377c33a0fee7fb72f12e6b86f/68747470733a2f2f7472617669732d63692e6f72672f6269744578706572742f70726f7068696c65722d707372372d6d6964646c65776172652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/bitExpert/prophiler-psr7-middleware)[![Coverage Status](https://camo.githubusercontent.com/600dc6a6cbd690574e39221154f5f2ef63e0a0f98531a936d2409f1c72e57a4d/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6269744578706572742f70726f7068696c65722d707372372d6d6964646c65776172652f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/bitExpert/prophiler-psr7-middleware?branch=master)

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

[](#installation)

The preferred way of installing `bitexpert/prophiler-psr7-middleware` is through Composer. Simply add `bitexpert/prophiler-psr7-middleware` as a dependency:

```
composer.phar require bitexpert/prophiler-psr7-middleware

```

How to use the Prophiler PSR7 Middleware
----------------------------------------

[](#how-to-use-the-prophiler-psr7-middleware)

Create the Prophiler toolbar:

```
    $prophiler = new \Fabfuel\Prophiler\Profiler();
    $toolbar = new \Fabfuel\Prophiler\Toolbar($prophiler);
```

Set-up your PSR-7 middleware, e.g. by using zendframework/zend-stratigility:

```
    $request = \Zend\Diactoros\ServerRequestFactory::fromGlobals();
    $response = \Zend\Diactoros\Response();

    $app = new \Zend\Stratigility\MiddlewarePipe();
```

Add the ProphilerMiddleware to the Middleware pipe:

```
    $app->pipe(new \bitExpert\Http\Middleware\Psr7\Prophiler\ProphilerMiddleware($toolbar));
```

"Execute" the Middleware pipe:

```
    $response = $app($request, $response);
```

How to add the Prophiler PSR7 Middleware to an Expressive app
-------------------------------------------------------------

[](#how-to-add-the-prophiler-psr7-middleware-to-an-expressive-app)

### Expressive 1.x

[](#expressive-1x)

Register a pre\_routing middleware in `config/autoload/middleware-pipeline.local.php`:

```
return [
    'middleware_pipeline' => [[
        'middleware' => bitExpert\Http\Middleware\Psr7\
            Prophiler\ProphilerMiddleware::class,
        'priority' => 11000,
    ]]
];
```

Add a factory definition to `config/autoload/dependencies.global.php`:

```
return [
    'dependencies' => [
        'factories' => [
            bitExpert\Http\Middleware\Psr7\Prophiler\
                ProphilerMiddleware::class =>
                App\Middleware\ProphilerFactory::class
        ]
    ]
];
```

The `\App\Middleware\ProphilerFactory` implementation looks like this:

```
namespace App\Middleware;

use Interop\Container\ContainerInterface;
use Fabfuel\Prophiler\Profiler;
use Fabfuel\Prophiler\Toolbar;
use bitExpert\Http\Middleware\Psr7\Prophiler\ProphilerMiddleware;

class ProphilerFactory
{
    public function __invoke(ContainerInterface $container)
    {
        $prophiler = new Profiler();
        $toolbar = new Toolbar($prophiler);
        return new ProphilerMiddleware($toolbar);
    }
}
```

### Expressive 2.x (Programmatic Pipelines)

[](#expressive-2x-programmatic-pipelines)

Adding the following code snippet to the `config/pipeline.php` file:

```
$app->pipe(ErrorHandler::class);

$debug = $app->getContainer()->get('config')['debug'] ?? false;
if ($debug) {
   $prophiler  = new \Fabfuel\Prophiler\Profiler();
   $toolbar    = new \Fabfuel\Prophiler\Toolbar($prophiler);
   $middleware = new \bitExpert\Http\Middleware\Psr7\Prophiler\ProphilerMiddleware($toolbar);
   $app->pipe($middleware);
}

$app->pipe(ServerUrlMiddleware::class);
```

Configure Prophiler
-------------------

[](#configure-prophiler)

By default Prophiler will not log or profile anything. You can add custom benchmarks by adding the following code snippet to the code you want to profile:

```
$profiler->start('\My\Class::doSomeOtherThing', ['additional' => 'information'], 'My Component');

// here be your custom code

$profiler->stop();
```

In addition to that Prophiler offers a lot of [adapters and decorators](https://github.com/fabfuel/prophiler#adapters-and-decorators)for 3rd party tools and libraries.

License
-------

[](#license)

The Prophiler PSR7 Middleware is released under the Apache 2.0 license.

###  Health Score

33

—

LowBetter than 74% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 95.6% 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 ~72 days

Recently: every ~160 days

Total

11

Last Release

3135d ago

PHP version history (4 changes)0.1.0PHP &gt;=5.5

0.1.3PHP ^5.5|^7.0

v0.4.0PHP ^5.6|^7.0

v0.5.0PHP ^7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/1adf0ab660536efce10aeb97f0c90ec881110b64fbd23429fa945190df0def56?d=identicon)[shochdoerfer](/maintainers/shochdoerfer)

---

Top Contributors

[![shochdoerfer](https://avatars.githubusercontent.com/u/596449?v=4)](https://github.com/shochdoerfer "shochdoerfer (65 commits)")[![belgattitude](https://avatars.githubusercontent.com/u/259798?v=4)](https://github.com/belgattitude "belgattitude (1 commits)")[![lowtower](https://avatars.githubusercontent.com/u/426242?v=4)](https://github.com/lowtower "lowtower (1 commits)")[![weierophinney](https://avatars.githubusercontent.com/u/25943?v=4)](https://github.com/weierophinney "weierophinney (1 commits)")

---

Tags

middlewareprophiler-psr7-middlewareprophiler-toolbarpsr-7zend-stratigilitypsr-7psr7prophiler

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/bitexpert-prophiler-psr7-middleware/health.svg)

```
[![Health](https://phpackages.com/badges/bitexpert-prophiler-psr7-middleware/health.svg)](https://phpackages.com/packages/bitexpert-prophiler-psr7-middleware)
```

###  Alternatives

[league/route

Fast routing and dispatch component including PSR-15 middleware, built on top of FastRoute.

6633.1M116](/packages/league-route)[dflydev/fig-cookies

Cookies for PSR-7 HTTP Message Interface.

2268.5M101](/packages/dflydev-fig-cookies)[neomerx/cors-psr7

Framework agnostic (PSR-7) CORS implementation (www.w3.org/TR/cors/)

682.4M19](/packages/neomerx-cors-psr7)[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28137.8k](/packages/phpro-http-tools)[wellrested/wellrested

Simple PHP Library for RESTful APIs

4818.7k4](/packages/wellrested-wellrested)[mtymek/blast-base-url

PSR-7 middleware and helpers for working with base URL.

1054.0k3](/packages/mtymek-blast-base-url)

PHPackages © 2026

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