Download the PHP package internetrix/silverstripe-server-timing without Composer

On this page you can find all versions of the php package internetrix/silverstripe-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 silverstripe-server-timing

Introduction

This module allows developers to add Server-Timing information to headers for a SilverStripe application.

The Server Timing API allows you to pass request-specific timing data from the server to the browser via response headers.

This is an example of the Server Timing header information looks in development tools of Chrome:

Requirements

Installation

Configuration

It is recommended to add the \Internetrix\Control\Middleware\ServerTimingMiddleware::class to the top of the middleware execution pipeline. This will require the middleware to be added before the SilverStripe CMS has been fully bootstrapped.

To do so we can edit the SilverStripe CMS entry point file located either at public/index.php, or directly in your project root at index.php if your project doesn't use the public web root.

Find the line that instantiates HTTPApplication. Call the addMiddleware method on the HTTPApplication instance and pass it an instance of the ServerTimingMiddleware class. Remember to pass it an instance of ServerTiming:

By default the following metrics is added to the response headers:

Adding more timing metrics

A developer can also add more timing-metrics to the header by using start and end methods on the Internetrix\Helper\ServerTiming class. Please note that the name of the metric should be passed as the parameter and needs to be the same for start and stop.

The start and stop methods can be called from within different parts of the SilverStripe application.

Alternatively, we can also use the addMetric method on ServerTiming when we want to measure a metric from the start of the request. The duration for the metric will then be calculated using the start time of the request and the current time.

Client-Side Analytics Integration

Note: The interface may only available in secure contexts (HTTPS) in some browsers.

The default and custom timing metrics defined in the Server-Timing headers can be retrieved on the client-side for third-party Analytics integration (i.e Google Analytics) using the PerformanceObserver Web API using JavaScript.

Add the following script to the base Page.ss template file and/or any pages before the </body> tag you want the server-timing API information to be retrieved on the client-side. The script will push all server-timing metrics data to a global dataLayer JavaScript variable which can then be used for analytics.

This is an example of how the default Server-Timing metrics are stored within the global dataLayer variable:

Credits

This module was inspired and based on the following package for the Laravel framework:

https://github.com/beyondcode/laravel-server-timing.

It has been refactored to be compatible with the SilverStripe framework.

Licence

Please see License File for more information.


All versions of silverstripe-server-timing with dependencies

PHP Build Version
Package Version
Requires silverstripe/vendor-plugin Version ^1.0
silverstripe/framework Version ~4.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 internetrix/silverstripe-server-timing contains the following files

Loading the files please wait ....