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. rocketeers-app/lighthouse-php

ActiveLibrary

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 1mo 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 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity46

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

1314d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/351b7f13a9ccffc41ba6be5ade3f23e41749b5a2a4f05ee3b046d8b0ed85e23f?d=identicon)[vormkracht10](/maintainers/vormkracht10)

---

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

[joselfonseca/lighthouse-graphql-passport-auth

Add GraphQL types and mutations for login and recover password functionalities

234769.9k1](/packages/joselfonseca-lighthouse-graphql-passport-auth)[daniel-de-wit/lighthouse-sanctum

Laravel Sanctum support for Laravel Lighthouse.

61115.9k](/packages/daniel-de-wit-lighthouse-sanctum)[dzava/lighthouse

Interface for the Google Lighthouse project

4010.4k](/packages/dzava-lighthouse)[yakovenko/laravel-lighthouse-graphql-multi-schema

A Laravel package that provides multi-schema support for Lighthouse GraphQL.

1562.5k](/packages/yakovenko-laravel-lighthouse-graphql-multi-schema)[stayallive/lighthouse-graphql-hive

Performance monitoring Lighthouse with GraphQL Hive.

2223.3k](/packages/stayallive-lighthouse-graphql-hive)

PHPackages © 2026

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