logiek/laravel-google-lighthouse
Run Google Lighthouse audits directly from your Laravel app. Generate performance, accessibility, SEO, and best-practices reports programmatically, with a clean API for automating audits and storing results.
Architecture fit. The package is a thin Laravel wrapper around Google Lighthouse, which is a Node.js CLI that drives headless Chrome. That means the actual audit engine is not PHP and is not vendored — the Laravel side contributes a service provider, a config file, a fluent facade-style API, an Artisan command, score-threshold assertions, and JSON report parsing. Architecturally this is a convenience layer over an out-of-process binary, so the package occupies the "orchestration and result parsing" slot in your stack, not the "audit engine" slot. It fits cleanly only where a Laravel application already has (or can be given) Node.js and a Chrome/Chromium binary on the same host or image.
Integration feasibility. High on a Laravel 9/10 application, provided node, npm/npx, and a Chrome binary are present and the Composer constraints still resolve. Low-to-blocked on Laravel 11/12: the last release (2023-08-10) predates Laravel 11, and the package is archived, so no compatibility release is coming. Feasibility is also poor for anything that expects to run audits inside a web request — the runtime cost and process-spawning model push this toward queue workers or CI runners.
Technical risk. This is the dominant concern and it is structural, not incidental. Four risks compound:
Key questions. Which Laravel and PHP versions are actually in the Composer constraints, and does it install on our target stack today? Does the audit run as a subprocess (npx lighthouse) at call time, and is there a timeout/queue story? Which Chrome and Node versions does it assume, and are those pinned anywhere? Are score thresholds exposed as test assertions suitable for CI gating, or only as return values? What does the raw JSON parsing do when Lighthouse emits partial or errored reports? Who forks it if we need a Laravel 11+ compatibility patch — and is that cheaper than invoking the Lighthouse CLI directly from our own code?
Stack fit. Best fit is a Laravel 9/10 service that already ships a container image with Node and headless Chrome — typically because it already runs frontend builds or browser-based tests. Worst fit is a slim PHP-FPM image on a managed platform where you cannot add system binaries. The package's natural home is a CI job or a dedicated audit worker, not the request/response path of a customer-facing app.
Migration path. Greenfield adoption is a single composer require plus a published config file. For teams already calling Lighthouse directly via shell scripts, the migration is a like-for-like swap: replace shell invocations with the Artisan command or fluent API, keep the same thresholds, and diff the JSON output for a release or two before deleting the old scripts. There is no data migration and no schema change; the only state is whatever you choose to persist from the reports.
Compatibility. Treat the supported window as Laravel 9/10 and whatever PHP versions the 2023 constraints allow — verify, do not assume. Because the package is archived, plan for it to be the last thing you upgrade, and expect it to become the blocker on your next framework major. Verify Chrome availability with /usr/bin/chromium vs /usr/bin/google-chrome differences and the --no-sandbox requirement in containerized environments; this is the most common first-run failure.
Sequencing.
--no-sandbox where required, set explicit process timeouts.Process::run('npx lighthouse ...') wrapper.Maintenance. The package is archived, so ongoing maintenance is your responsibility by default. Realistically that means vendoring it, or accepting a pinned version that will fail to install after the next framework major. Budget a fork-and-patch contingency rather than assuming upstream will catch up. The underlying Lighthouse CLI also moves fast and changes score weights and audit categories between majors, so "the number went down" may reflect a tool upgrade rather than a regression — pin the Lighthouse version too.
Support. No vendor, no SLA, no security disclosure channel, five stars of community. Internal ownership must be named explicitly. Security-relevant exposure is indirect: the package shells out to Chrome, so your real attack surface is whatever URL you point it at, not the wrapper code itself — which argues for restricting it to first-party URLs and never to user-supplied ones.
Scaling. Each audit spawns a headless Chrome instance consuming hundreds of MB of RAM and many seconds of CPU. This does not scale horizontally with request volume and must never run inline in a web request. Scale by adding queue workers with concurrency limits and memory headroom, or by pushing audits to CI. Cost scales linearly with audit count and is dominated by compute, not by the package.
Failure modes. Expect: Chrome missing or wrong binary path; sandbox permission errors in containers; audit timeouts on slow or JS-heavy pages; memory exhaustion on constrained workers; score flakiness breaking CI gates; Laravel/PHP constraint conflicts after any framework upgrade; Node version drift breaking the CLI invocation; unreachable or auth-gated URLs producing errored reports that the parser may not handle gracefully. Design every integration point to fail open — a failed audit should warn, not block a deploy, until you trust the signal.
Ramp-up. Low for the PHP side: a Laravel developer can read the fluent API and Artisan command in an afternoon. The real ramp is on the platform side — Node/Chrome provisioning, container sandboxing, and interpreting Lighthouse variance. Assign that to whoever owns CI and container images, not to the feature team. Expect one to two days of environment work before the first reliable audit, and several weeks of data before thresholds are trustworthy enough to gate on.
How can I help you explore Laravel packages today?