Download the PHP package rocketeers-app/lighthouse-php without Composer
On this page you can find all versions of the php package rocketeers-app/lighthouse-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rocketeers-app/lighthouse-php
More information about rocketeers-app/lighthouse-php
Files in rocketeers-app/lighthouse-php
Package lighthouse-php
Short Description Interface for the Google Lighthouse project
License MIT
Homepage https://github.com/rocketeers-app/lighthouse-php
Informations about the package lighthouse-php
Lighthouse PHP
This package provide a php interface for Google Lighthouse.
Installation
You can install the package via composer:
Install Lighthouse
Usage
Here's an example that will perform the default Lighthouse audits and store the result in report.json
(You can use the Lighthouse Viewer to open the report):
Output
The setOutput
method accepts a second argument that can be used to specify the format (json,html).
If the format argument is missing then the file extension will be used to determine the output format.
If the file extension does not specify an accepted format, then json will be used.
You can output both the json and html reports by passing an array as the second argument. For the example
the following code will create two reports example.report.html
and example.report.json
.
Using a custom config
You can provide your own configuration file using the withConfig
method.
Customizing node and Lighthouse paths
If you need to manually set these paths, you can do this by calling the setNodeBinary
and setLighthousePath
methods.
Passing flags to Chrome
Use the setChromeFlags
method to pass any flags to the Chrome instance.
Troubleshooting
Audit of 'url' failed
Use the following snippet to check why the audit fails.