Download the PHP package rawand201/filament-spatie-lighthouse without Composer
On this page you can find all versions of the php package rawand201/filament-spatie-lighthouse. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rawand201/filament-spatie-lighthouse
More information about rawand201/filament-spatie-lighthouse
Files in rawand201/filament-spatie-lighthouse
Package filament-spatie-lighthouse
Short Description A Filament plugin for running and viewing Google Lighthouse audit results
License MIT
Homepage https://github.com/Rawand201/filament-spatie-lighthouse
Informations about the package filament-spatie-lighthouse
Filament Spatie Lighthouse
A Filament plugin that integrates spatie/lighthouse-php to run Google Lighthouse audits directly from your admin panel — view scores, performance metrics, failed audits, audit history, and full HTML reports without leaving Filament.
Demo
Table of Contents
- Requirements
- Installation
- Basic Usage
- Plugin Options
- Configuration Reference
- Raw Results Storage
- Queue Support
- Scheduled Audits
- Notifications
- REST API Endpoints
- Artisan Commands
- Events
- Custom Result Store
- Extending the Page
- Contributing
- Credits
- Changelog
- License
Requirements
| Requirement | Version |
|---|---|
| PHP | ^8.2 |
| Laravel | ^11.0 \| ^12.0 |
| Filament | ^4.0 \| ^5.0 |
| spatie/lighthouse-php | ^2.0 |
| Node.js | ^18.0 \| ^20.0 \| ^22.0 |
lighthouse (npm) |
^12.0 |
| Chrome / Chromium | any recent version |
Note: The
lighthousenpm package must be installed on the server. Run:Then verify:
npx lighthouse --version
spatie/lighthouse-phpalso requires a Chromium-based browser. See their documentation for full setup.
Installation
1. Install the package:
2. Publish and run the migration:
3. (Optional) Publish the config file:
4. Register the plugin in your Filament panel provider:
That's it. A "Lighthouse Results" page will appear in your panel's navigation.
Basic Usage
Once installed, navigate to the Lighthouse Results page in your Filament panel. Enter a URL and click Run Audit. The plugin will:
- Run a Lighthouse audit via
spatie/lighthouse-php - Save the results (scores + raw data)
- Display category scores, performance metrics, and failed audits
Each row in the results table has actions to:
- View the full result detail page
- View HTML Report — opens the native Lighthouse HTML report inline
- Download HTML Report — downloads the report as a
.htmlfile - Delete the record
Plugin Options
Customise the plugin when registering it in your panel provider:
All available methods
| Method | Type | Default | Description |
|---|---|---|---|
navigationGroup(string\|Closure\|null) |
static |
translation key | Navigation group label |
navigationLabel(string\|Closure\|null) |
static |
translation key | Nav item label |
navigationIcon(string\|Closure) |
static |
heroicon-o-chart-bar |
Nav item icon |
navigationSort(int\|Closure) |
static |
1 |
Sort order within group |
authorize(bool\|Closure) |
static |
true |
Access control callback |
usingPage(string) |
static |
LighthouseResults::class |
Custom page class |
Configuration Reference
After publishing, edit config/filament-spatie-lighthouse.php. Below is the full reference:
Result Store
Raw Results Storage
Controls where the large raw Lighthouse JSON (500KB–2MB per audit) is saved:
See Raw Results Storage for details.
Database
Cache
Audit Timeout
History Retention
Default Audit Categories
Queue
Score Thresholds
Controls the colour indicators on score badges:
Metric Thresholds
Controls the colour indicators on individual performance metrics:
Display Options
Fine-grained control over which UI sections are shown:
Export
Scheduling
Notifications
REST API Endpoints
Raw Results Storage
Each Lighthouse audit produces a raw JSON result of 500KB–2MB. By default this is stored in a raw_results database column. For production deployments with frequent audits, this can bloat your database significantly.
The plugin supports opt-in filesystem storage — the raw JSON is written to disk (or any Laravel filesystem disk including S3) and only the file path is stored in the database.
Enable filesystem storage
In .env:
Or in config/filament-spatie-lighthouse.php:
How it works
| Mode | raw_results column |
raw_result_path column |
|---|---|---|
database (default) |
Full JSON blob | null |
filesystem |
null |
Path on disk (e.g. lighthouse-results/abc123-2025-01-01.json) |
The HTML report view and download actions transparently resolve the raw results from either location — no change is needed to how you use the plugin.
Tip: You can mix both modes in the same database — existing records with
raw_resultscontinue to work after you switch tofilesystem.
Queue Support
Running Lighthouse synchronously blocks the web request for up to 3 minutes. For production use, queue audits in a background worker.
Enable queue mode in .env:
Then run a queue worker:
When queue mode is enabled, clicking "Run Audit" in the UI dispatches a RunLighthouseAuditJob. The table polls every 30 seconds by default (configurable via display.table_poll_interval) and updates when the job completes.
Dispatching manually
Scheduled Audits
The plugin registers its own schedule using Laravel's Schedule facade — you do not need to modify your app/Console/Kernel.php.
Configure URLs to audit on a schedule:
Make sure the Laravel scheduler is running:
Supported frequencies: hourly, daily, weekly.
You can also dispatch a one-off scheduled job from the command line:
Notifications
The plugin can send notifications when an audit completes or fails.
The email includes the URL, all four category scores, and a timestamp.
Slack
The Slack attachment is colour-coded based on the performance score (green ≥ 90, orange ≥ 50, red < 50).
REST API Endpoints
The plugin exposes optional read-only HTTP endpoints for fetching audit results programmatically.
Enable in config:
Authenticate requests by passing the token in a header or query string:
Available endpoints
| Method | Endpoint | Auth | Description |
|---|---|---|---|
GET |
/{prefix}/health |
No | Health check |
GET |
/{prefix}/latest?url=... |
Yes | Latest result for a URL |
GET |
/{prefix}/results |
Yes | All results (paginated) |
GET |
/{prefix}/results/{id} |
Yes | Single result by ID |
Artisan Commands
lighthouse:audit
Run an audit synchronously and display a score table in the terminal:
lighthouse:schedule
Dispatch an audit job to the queue:
lighthouse:list
List recent audit results:
Auto-pruning old records
The LighthouseAuditResult model uses MassPrunable. Add this to your scheduler (or run manually):
Records older than keep_history_for_days days (default: 30) are deleted.
Events
The plugin dispatches three events during the audit lifecycle. All events are queue-safe (no non-serializable objects).
| Event | When | Properties |
|---|---|---|
AuditStartingEvent |
Just before the audit runs | $url, $categories, $formFactor, $userId |
AuditEndedEvent |
Audit completed successfully | $url, $scores (array, 0–100 per category), $userId |
AuditFailedEvent |
Audit threw an exception | $url, $exception, $userId |
Listening to events
Custom Result Store
Implement the ResultStore interface to plug in any storage backend (Redis, DynamoDB, etc.):
Bind it in a service provider:
StoredAuditResults constructor
Extending the Page
To override any behaviour on the Lighthouse Results page, extend the base class:
Register it via the plugin:
Contributing
Contributions are welcome! Please read CONTRIBUTING.md before submitting a pull request.
Credits
See CREDITS.md for the full list.
Changelog
See CHANGELOG.md.
License
MIT — see LICENSE.
All versions of filament-spatie-lighthouse with dependencies
filament/filament Version ^4.0|^5.0
spatie/lighthouse-php Version ^2.0
spatie/laravel-package-tools Version ^1.9