PHPackages                             rocketeers-app/lighthouse-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. rocketeers-app/lighthouse-php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

rocketeers-app/lighthouse-php
=============================

Interface for the Google Lighthouse project

v1.0.0(3y ago)17.3kMITPHPPHP &gt;=7.4

Since Oct 2Pushed 3y agoCompare

[ Source](https://github.com/rocketeers-app/lighthouse-php)[ Packagist](https://packagist.org/packages/rocketeers-app/lighthouse-php)[ Docs](https://github.com/rocketeers-app/lighthouse-php)[ RSS](/packages/rocketeers-app-lighthouse-php/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

Lighthouse PHP
==============

[](#lighthouse-php)

[![Latest Version on Packagist](https://camo.githubusercontent.com/488f27562f6c3a2014e8867e852536138f64bc332da3aff2e962c81cefff3ef7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f726f636b6574656572732d6170702f6c69676874686f7573652d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rocketeers-app/lighthouse-php)[![Total Downloads](https://camo.githubusercontent.com/f48b666a1c96b7e112eee94d90f6c3160c9fb0a6019203d35c6e37265d74dbc9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f726f636b6574656572732d6170702f6c69676874686f7573652d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rocketeers-app/lighthouse-php)

This package provide a php interface for [Google Lighthouse](https://github.com/GoogleChrome/lighthouse).

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require rocketeers-app/lighthouse-php

```

Install Lighthouse

`npm install lighthouse`

Usage
-----

[](#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](https://googlechrome.github.io/lighthouse/viewer/) to open the report):

```
use Rocketeers\Lighthouse\Lighthouse;

(new Lighthouse())
    ->setOutput('report.json')
    ->accessibility()
    ->bestPractices()
    ->performance()
    ->pwa()
    ->seo()
    ->audit('http://example.com');
```

### Output

[](#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`.

```
use Rocketeers\Lighthouse\Lighthouse;

(new Lighthouse())
    ->setOutput('example', ['html', 'json'])
    ->performance()
    ->audit('http://example.com');
```

### Using a custom config

[](#using-a-custom-config)

You can provide your own configuration file using the `withConfig` method.

```
use Rocketeers\Lighthouse\Lighthouse;

(new Lighthouse())
    ->withConfig('./my-config.js')
    ->audit('http://example.com');
```

### Customizing node and Lighthouse paths

[](#customizing-node-and-lighthouse-paths)

If you need to manually set these paths, you can do this by calling the `setNodeBinary` and `setLighthousePath` methods.

```
use Rocketeers\Lighthouse\Lighthouse;

(new Lighthouse())
    ->setNodeBinary('/usr/bin/node')
    ->setLighthousePath('./node_modules/lighthouse/lighthouse-cli/index.js')
    ->audit('http://example.com');
```

### Passing flags to Chrome

[](#passing-flags-to-chrome)

Use the `setChromeFlags` method to pass any flags to the Chrome instance.

```
use Rocketeers\Lighthouse\Lighthouse;

(new Lighthouse())
    // these are the default flags used
    ->setChromeFlags(['--headless', '--disable-gpu', '--no-sandbox'])
    ->audit('http://example.com');
```

Troubleshooting
---------------

[](#troubleshooting)

#### Audit of 'url' failed

[](#audit-of-url-failed)

Use the following snippet to check why the audit fails.

```
require "./vendor/autoload.php";

use Rocketeers\Lighthouse\Exceptions\AuditFailedException;
use Rocketeers\Lighthouse\Lighthouse;

try {
(new Lighthouse())
    ->performance()
    ->audit('http://example.com');
} catch(AuditFailedException $e) {
    echo $e->getOutput();
}
```

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1359d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7c6a425dc8645907a118a007438172d58c2016773f54ab3a834beff172632f13?d=identicon)[ux](/maintainers/ux)

---

Top Contributors

[![dzava](https://avatars.githubusercontent.com/u/1516475?v=4)](https://github.com/dzava "dzava (18 commits)")[![markvaneijk](https://avatars.githubusercontent.com/u/1925388?v=4)](https://github.com/markvaneijk "markvaneijk (9 commits)")

---

Tags

core-web-vitalslighthouselighthouse-auditslighthouse-phplighthouse-scorephplighthouse

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rocketeers-app-lighthouse-php/health.svg)

```
[![Health](https://phpackages.com/badges/rocketeers-app-lighthouse-php/health.svg)](https://phpackages.com/packages/rocketeers-app-lighthouse-php)
```

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.6k38.2k](/packages/matomo-matomo)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

749284.3k35](/packages/civicrm-civicrm-core)[spatie/laravel-export

Create a static site bundle from a Laravel app

672139.5k6](/packages/spatie-laravel-export)[illuminate/process

The Illuminate Process package.

44813.9k96](/packages/illuminate-process)[dzava/lighthouse

Interface for the Google Lighthouse project

4010.9k](/packages/dzava-lighthouse)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
