Retrieve all performance records with the PHP SDK

This page will get you started retrieving the performance metrics of your sites with the PHP SDK. Make sure you've read the getting started guide first. Once that's done, you should have our package & authentication ready to go.

Retrieve all performance metrics #

The simplest example is one where we retrieve the performance metrics for a site in a particular time window. Here, we'll get the performance periods for a site with ID 1.

$records = $ohDear->performanceRecords(1, '2020-06-07', '2020-06-08');

The above example will retrieve the performance metrics between 2020-06-07 and 2020-06-08. You can also be more specific with your request, by including the hour/minute/seconds:

$records = $ohDear->performanceRecords(1, '2020-06-07 09:00:00', '2020-06-08 17:00:00');

The SDK will convert any date format to the correct notation our API expects.

This will return an array of OhDear\PhpSdk\Resources\PerformanceRecord instances.

You can get a few properties of a performance record.

$record->id;
$record->siteId;
$record->timeRemoteserver;
$record->timeTotal;

Was this page helpful to you? Feel free to reach out via support@ohdear.app or on Twitter via @OhDearApp if you have any other questions. We'd love to help!