A WordPress API library for using the Google PageSpeed API.

link Documentation
see WP API Libraries
package WP-API-Libraries\WP-Google-PageSpeed-API
author imFORZA

 Methods

__construct function.

__construct(mixed $api_key) : void
access public

Parameters

$api_key

mixed

API Key.

Runs PageSpeed analysis on the page at the specified URL, and returns PageSpeed scores, a list of suggestions to make that page faster, and other information.

run_pagespeed(string $url, boolean $filter_third_party = '', string $locale = '', string $rule = '', boolean $screenshot = '', string $strategy = '') : array
API
api GET
see Documentation
access public

Parameters

$url

string

The URL to fetch and analyze.

$filter_third_party

boolean

Indicates if third party resources should be filtered out before PageSpeed analysis. (Default: false).

$locale

string

The locale used to localize formatted results.

$rule

string

A PageSpeed rule to run; if none are given, all rules are run.

$screenshot

boolean

Indicates if binary data containing a screenshot should be included (Default: false).

$strategy

string

The analysis strategy to use. Accepted values: desktop, mobile.

Returns

arrayPageSpeed Results.

Fetch the request from the API.

fetch(mixed $request) : \$body
access private

Parameters

$request

mixed

Request URL.

Returns

\$bodyBody.

 Properties

 

API Key.

$api_key : string

Default

Static
 

URL to the API.

$base_uri : string

Default

'https://www.googleapis.com/pagespeedonline/v2/runPagespeed'