Robo Google Lighthouse
Run Google Lighthouse commands from the Robo task runner., (*1)
Prerequisites
- Install node
brew install node
- Install lighthouse
npm install -g lighthouse
Getting Started
First, you'll need to download the Robo Google Lighthouse library using composer:, (*2)
composer require droath/robo-google-lighthouse
Example
Output an HTML file of the performance results., (*3)
<?php
use Droath\RoboGoogleLighthouse\Task\loadTasks;
$url = 'https://google.com';
$path = '/tmp/example.html';
$this->taskGoogleLighthouse()
->setUrl($url)
->performanceTestOnly()
->setOutputPath($path)
->run();
Output an JSON file of the results., (*4)
<?php
use Droath\RoboGoogleLighthouse\Task\loadTasks;
$url = 'https://google.com';
$path = '/tmp/example.json';
$this->taskGoogleLighthouse()
->setUrl($url)
->setOutput('json')
->setOutputPath($path)
->run();
Support
The majority of the lighthouse commands available in the CLI tool are supported.
If you find any discrepancies, please feel free to open up a GitHub issue., (*5)