2017 © Pedro Peláez
 

library pagespeed-parser

php module to parse pagespeed insights api results

image

c4pone/pagespeed-parser

php module to parse pagespeed insights api results

  • Wednesday, October 28, 2015
  • by floriank
  • Repository
  • 0 Watchers
  • 3 Stars
  • 58 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

PageSpeed Insights API Parser

This simple php module parses the results from PageSpeed Insights API., (*1)

Installation

The best way to install the library is by using Composer. Add the following to composer.json in the root of your project:, (*2)

``` javascript { "require": { "c4pone/pagespeed-parser": "dev-master", } }, (*3)


Then, on the command line: ``` bash curl -s http://getcomposer.org/installer | php php composer.phar install

Use the generated vendor/.composer/autoload.php file to autoload the library classes., (*4)

Basic usage

For easy usage we use the pagespeed insights api client from sgrodzicki, (*5)

<?php

$url = 'http://www.codebuster.de';

$pageSpeed = new \PageSpeed\Insights\Service();
$pageSpeed->getResults($url, 'en_US', 'desktop', array('screenshot' => true));

$parser = new \c4pone\PageSpeed\Parser($pageSpeed->getResults());
$parser->getTitle();
$parser->getPageStats();
$parser->getRecommendations();

$screenshot = $parser->getScreenshot();
$screenshot->save('some/path/screenshot.jpg');

Tests

Build Status, (*6)

The client is tested with phpunit; you can run the tests, from the repository's root, by doing:, (*7)

bash phpunit, (*8)

Some tests may fail, due to requiring an internet connection (to test against a real API response). Make sure that you are connected to the internet before running the full test suite., (*9)

The Versions

28/10 2015

dev-master

9999999-dev https://github.com/c4pone/pagespeed-parser

php module to parse pagespeed insights api results

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

api parser google pagespeedinsights