appiusattaprobus/server-timing

Add Server-Timing header information from your apps

1.0.2 2020-05-05 11:18 UTC

This package is auto-updated.

Last update: 2025-07-05 23:35:34 UTC


README

Add Server-Timing header information from your apps.

Installation

You can install the package via composer:

composer require appiusattaprobus/server-timing

Usage

use Appiusattaprobus\ServerTiming\StopWatch;

Whole block

StopWatch::start('Task 1');

sleep(1); // do something

StopWatch::stop('Task 1');  // Not necessary. At set headers all timers stop
StopWatch::setTimingHeader();

server-timing

Closure

$closureTimer = StopWatch::measureFunc('Closure', function () {
    usleep(500000);
});

By parts

StopWatch::start('Part');
sleep(1);
StopWatch::pause('Part');
sleep(3);
StopWatch::resume('Part');
sleep(1);
StopWatch::stop('Part');

Changelog

Please see CHANGELOG for more information on what has changed recently.

License

The MIT License (MIT). Please see License File for more information.