clarkeash/laravel-http-stats

Get access to stats for your http requests

v1.0.0 2020-04-04 20:12 UTC

README

GitHub Workflow Status 68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f636c61726b656173682f6c61726176656c2d687474702d73746174732e7376673f7374796c653d666f722d7468652d6261646765 687474703a2f2f696d672e736869656c64732e696f2f62616467652f617574686f722d40636c61726b656173682d626c75652e7376673f7374796c653d666f722d7468652d6261646765

Laravel Http Stats gives you access to the transfer stats of HTTP stats performed through Laravels HTTP Client.

Installation

You can pull in the package using composer:

$ composer require clarkeash/laravel-http-stats

Usage

Once you have made a request like so:

use Illuminate\Support\Facades\Http;

$response = Http::get('http://test.com');

You will now have access to a stats method on the $response object.

$response->stats()->lookup(); // dns time in ms
$response->stats()->connect(); // tcp connection time in ms
$response->stats()->ssl(); // ssl handshake time in ms
$response->stats()->pretransfer(); // Protocol negotiation time in ms
$response->stats()->redirect(); // redirect time in ms
$response->stats()->ttfb(); // time to first byte in ms
$response->stats()->total(); // total time in ms