Download the PHP package fetzi/server-timing without Composer

On this page you can find all versions of the php package fetzi/server-timing. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package server-timing

Server-Timing middleware package

Packagist Github Actions StyleCI Maintainability

server-timing is a PHP middleware package that adds the Server-Timing header to your responses. This information can be viewed in your web browser, for example in Google Chrome.

More information on the ServerTiming response header can be found on MDN docs.

The package automatically adds two default metrics but allows you to add custom metrics as well.

Installation

Setup

The package automatically measures two Timing values in the middleware implementation:

  1. Bootstrap: The time taken in the application bootstrapping phase
  2. Request: The total time your request handler(s) needed to process your request

To make sure all timings are as exact as possible it is important to add the middleware at the outermost (last) position of your request handler stack.

PSR-15 Middleware

To enable the middleware you simply need to add an instance of Fetzi\ServerTiming\ServerTimingMiddleware to your middleware stack.

In a Slim application you can do this by simply adding

to your middleware stack code.

Laravel Middleware

To enable the middleware in your Laravel application you need to use the Fetzi\ServerTiming\Laravel\ServerTimingMiddleware class.

If you want to enable the middleware in general simply add the class definition to the $middleware array in the Kernel class. If you want to enable the middleware only if a condition is met, you need to override the handle method of the Kernel as demonstrated here.

Usage

To be able to add your custom server timings you need to make sure that you register the ServerTimings class as a singleton in your dependency injection container. This allows you to inject the ServerTimings class into any other class and create and measure a custom server timing.

This code will generate a new server timing named fetchUsers and by calling the start and the stop method the the execution time is measured.

Creating a ServerTiming instance

The ServerTimings class provides a create method to create a ServerTiming instance that is automatically registered and will be sent back by the middleware.

Measuring a ServerTiming

The ServerTiming instance provides two methods for starting and stopping the measurement.

The middleware will make sure to collect all measured ServerTiming instances and append their values in the Server-Timing response header.

License

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


All versions of server-timing with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2
psr/http-server-middleware Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package fetzi/server-timing contains the following files

Loading the files please wait ....