calderawp / page-speed
Get Google Page Speed data for a given URL
dev-master
2016-08-13 23:52 UTC
Requires
- calderawp/object: *
- rmccue/requests: >=1.0
This package is auto-updated.
Last update: 2024-12-08 08:30:12 UTC
README
Requires PHP7
Install
composer require calderawp/speed
Usage
Get API key and such https://developers.google.com/speed/docs/insights/v1/getting_started
use calderawp\speed\Client;
$key = 'YOUR KEY';
$url = 'https://calderawp.com';
$client = new Client( $url, $key );
try {
//If succesful you will have results as stdClass
$response = $client->query();
}catch( \Exception $e ){
return $e->getMessage();
}
//Get object of calderawp\speed\Result from results
//Try/catch above was to prevent this running without valid data, which would make fatal error, which is bad.
$result = $client->get_result();