Differences from PHP | lighthouse-go | Spatie       

 SPATIE  

lighthouse-go
=============

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Lighthouse-go](https://spatie.be/docs/lighthouse-go/v1)  Differences from PHP

 Version   v1      

 Other versions for crawler [v1](https://spatie.be/docs/lighthouse-go/v1) 

  Differences from PHP    
- [ Introduction ](https://spatie.be/docs/lighthouse-go/v1/introduction)
- [ Requirements ](https://spatie.be/docs/lighthouse-go/v1/requirements)
- [ Installation &amp; setup ](https://spatie.be/docs/lighthouse-go/v1/installation-setup)
- [ Questions and issues ](https://spatie.be/docs/lighthouse-go/v1/questions-issues)
- [ Differences from PHP ](https://spatie.be/docs/lighthouse-go/v1/go-differences)
- [ Testing ](https://spatie.be/docs/lighthouse-go/v1/testing)
- [ Releasing ](https://spatie.be/docs/lighthouse-go/v1/releasing)
- [ Changelog ](https://spatie.be/docs/lighthouse-go/v1/changelog)
- [ Support us ](https://spatie.be/docs/lighthouse-go/v1/support-us)
- [ About us ](https://spatie.be/docs/lighthouse-go/v1/about-us)

Usage
-----

- [ Generating your first report ](https://spatie.be/docs/lighthouse-go/v1/usage/generating-your-first-report)
- [ Configuring a run ](https://spatie.be/docs/lighthouse-go/v1/usage/configuring-a-run)
- [ Working with results ](https://spatie.be/docs/lighthouse-go/v1/usage/working-with-results)
- [ Saving an HTML report ](https://spatie.be/docs/lighthouse-go/v1/usage/saving-an-html-report)
- [ Using performance budgets ](https://spatie.be/docs/lighthouse-go/v1/usage/using-performance-budgets)

 Differences from PHP
====================

The PHP implementation is the behavior reference. The Rust port supplied lessons about current Lighthouse versions and process errors. The Go port keeps every PHP run setting and report operation, with these deliberate differences.

- `New(url, options...)` and `Run(ctx)` replace the mutable fluent builder. Fallible operations return errors. Durations replace integer seconds and milliseconds.
- Full Lighthouse and Chrome maps remain replaceable. Application-specific options use `func(*Config) error`. The PHP package has no models, jobs or profile classes requiring additional extension contracts.
- URLs must use HTTP or HTTPS. This does not protect against SSRF or access to private networks.
- Scores retain true zero values instead of PHP's accidental filtering. They truncate percentages like PHP, unlike Rust's rounding.
- Audit names are sorted because Go maps have no insertion order. Dot paths return nil for both absent and null values.
- Missing audits return `ErrAuditNotFound`. Missing numeric or display values within an existing audit return nil without an error. Formatted layout shift returns the original string. Benchmarks preserve fractional values.
- Screen emulation uses the correct Lighthouse `deviceScaleFactor` key, not PHP's `deviceScaleRatio` spelling. Current Lighthouse has four categories, not the five shown in older PHP docs.
- Node modules resolve from the application's working directory or `WorkingDirectory`, not from a package installation directory. Configuration is sent over stdin rather than process arguments.
- Both reports are generated from `lhr`, so custom output order does not lose JSON or HTML. Parse accepts saved PHP envelopes and JSON-string reports.
- Chrome cleanup runs on success and errors, with cooperative Unix cancellation and a two-second hard-kill grace period. Detached browser cleanup is not guaranteed on Windows or after forced termination. Use isolated workers for untrusted workloads.
- Legacy performance budgets require Lighthouse 11.7.1. The wrapper cannot restore audits removed by newer upstream versions.

Source references are [lighthouse-php](https://github.com/spatie/lighthouse-php) and [lighthouse-rust](https://github.com/spatie/lighthouse-rust). `testdata/example-com.json` is the original PHP example.com fixture and is covered by its MIT license.

 A good
match?
-------------

### What we do best

- All things Laravel
- Custom frontend components
- Building APIs
- AI-powered features
- Simplifying things
- Clean solutions
- Integrating services

### Not our cup of tea

- WordPress themes
- Cutting corners
- Free mockups to win a job
- "Just execute the briefing"

 In short: we'd like to be a **substantial part** of your project.

 [ Get in touch via email ](mailto:info@spatie.be?subject=A%20good%20match%21&body=Tell%20us%20as%20much%20as%20you%20can%20about%0A-%20your%20online%20project%0A-%20your%20planning%0A-%20your%20budget%0A-%20%E2%80%A6%0A%0AAnything%20that%20helps%20us%20to%20start%20straightforward%21)
