vilartoni / stackphp-xhprof
Stack middleware for Xhprof library
Installs: 305
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/vilartoni/stackphp-xhprof
Requires
- php: >=5.4.0
- lox/xhprof: dev-master
- symfony/http-kernel: ~2.1 | ~3.0
This package is not auto-updated.
Last update: 2025-10-15 15:43:24 UTC
README
This package contains a StackPHP middleware that activates XHProf profiling by leveraging the lox/xhprof library.
Just by sending xhprof=1 on the GET request, XhprofMiddleware will generate the profiling for the
requested URL and append a link to the results to the response.
Requirements
xhprof extension must be loaded. Otherwise an exception will be thrown.
Options
The XhprofMiddleware accepts an array of options:
- output_dir: the directory used to store XHProf runs.
Example
<?php use Avs\Stack\XhprofMiddleware; require_once __DIR__ . '../vendor/autoload.php'; $app = new Silex\Application(); $stack = (new Stack\Builder()) ->push(XhprofMiddleware::class, '/secret/xhprof'); $app = $stack->resolve($app); $request = Request::createFromGlobals(); $response = $app->handle($request)->send(); $app->terminate($request, $response);
Installation
The recommended way to install XhprofMiddleware is through Composer:
{
"require": {
"vilartoni/stackphp-xhprof": "dev-master"
}
}
Note: as this package depends on lox/xhprof which is in dev stability, you may need to
allow it explicitly in case you're not already using it.
{
"require": {
"vilartoni/stackphp-xhprof": "dev-master",
"lox/xhprof": "@dev"
}
}