library stack-timer
Simple StackPHP middleware for timing
rmasters/stack-timer
Simple StackPHP middleware for timing
- Wednesday, January 8, 2014
- by rmasters
- Repository
- 1 Watchers
- 1 Stars
- 5 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 2 Versions
- 0 % Grown
StackTimer
A simple StackPHP middleware that reports on the time it takes the
inner middlewares/app to run. Written to figure out what Stack can do :smiley:, (*1)
Usage
Simply wrap your application in the timer middleware and the load time will be
injected into the response body., (*2)
$app = new App(); // implements HttpKernelInterface
$timer = new StackTimer($app);
$request = Request::createFromGlobals();
$timer->handle($request)->send();
Options
Pass an array with any of the following keys to
StackTimer::__construct(HttpKernelInterface, array):, (*3)
-
inject (boolean, default: false) - whether to inject into the response
body,
-
callbacks (callable|callable[]) - an array of closures/callables that
are passed the following arguments:
function(HttpFoundation\Request $request, float $microseconds).
-
format (string, default:
{ms}ms) - the text to be injected, see list of
replaced strings below.
-
wrapper (string, default:
<div style="...">%s</div>) - HTML the text
is contained in, must contain a single %s where the text will be added.
-
injection (string, default:
</body>) - where to inject the snippet,
this is passed through preg_quote and cannot contain regular expressions.
-
inject_before (boolean, default: true) - whether to inject the snippet
before the injection point (i.e. before
</body>).
dev-master
9999999-dev
Simple StackPHP middleware for timing
Sources
Download
MIT
The Requires
The Development Requires
stack
timing
v1.0.0
1.0.0.0
Simple StackPHP middleware for timing
Sources
Download
MIT
The Requires
The Development Requires