PHPackages                             justinholtweb/craft-lightning - 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. justinholtweb/craft-lightning

ActiveCraft-plugin[Utility &amp; Helpers](/categories/utility)

justinholtweb/craft-lightning
=============================

Google PageSpeed Insights integration for Craft CMS — dashboard widget and entry-level performance auditing with Core Web Vitals metrics and optimization suggestions.

5.0.0(1mo ago)00proprietaryPHPPHP ^8.2

Since Jun 11Pushed 5d agoCompare

[ Source](https://github.com/justinholtweb/craft-lightning)[ Packagist](https://packagist.org/packages/justinholtweb/craft-lightning)[ RSS](/packages/justinholtweb-craft-lightning/feed)WikiDiscussions main Synced 1w ago

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

Lightning
=========

[](#lightning)

Google PageSpeed Insights for Craft CMS 5. Get performance scores, Core Web Vitals, and optimization suggestions right inside the control panel.

Features
--------

[](#features)

- **Dashboard widget** — monitor any URL with a one-click audit
- **Entry sidebar panel** — automatically appears on entries with public URLs
- **Core Web Vitals** — FCP, LCP, TBT, CLS, and Speed Index with color-coded scores
- **Optimization suggestions** — ranked opportunities with estimated time savings
- **Diagnostics** — additional performance issues flagged by Lighthouse
- **Mobile &amp; Desktop** — audit both strategies with a tabbed interface
- **Environment variable support** — store your API key in `.env`

Requirements
------------

[](#requirements)

- Craft CMS 5.3.0 or later
- PHP 8.2 or later
- A Google PageSpeed Insights API key

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

[](#installation)

Add the repository and require the package with Composer:

```
composer require justinholtweb/craft-lightning
```

Then install the plugin:

```
php craft plugin/install lightning
```

Or install from the control panel under **Settings &gt; Plugins**.

Setup
-----

[](#setup)

1. Get a free API key from the [Google Cloud Console](https://console.cloud.google.com/apis/credentials)
2. Enable the **PageSpeed Insights API** in your Google Cloud project
3. In the Craft control panel, go to **Settings &gt; Lightning**
4. Enter your API key (or use an environment variable like `$GOOGLE_PSI_API_KEY`)
5. Choose a default strategy (Mobile, Desktop, or Both)

### Using an environment variable

[](#using-an-environment-variable)

Add to your `.env` file:

```
GOOGLE_PSI_API_KEY=your-key-here

```

Then enter `$GOOGLE_PSI_API_KEY` in the plugin settings.

Usage
-----

[](#usage)

### Dashboard Widget

[](#dashboard-widget)

1. Go to the **Dashboard**
2. Click **New Widget &gt; PageSpeed Insights**
3. Enter the URL to audit and choose a strategy
4. Click **Run Audit** to see results

Add multiple widgets to monitor different pages.

### Entry Sidebar

[](#entry-sidebar)

The sidebar panel appears automatically on any entry that has a public URL. Click **Run Audit** to get the current performance data for that entry's page.

Scores
------

[](#scores)

Scores follow Google's thresholds:

RangeRating90–100Good (green)50–89Needs Improvement (orange)0–49Poor (red)API Rate Limits
---------------

[](#api-rate-limits)

With an API key, you get approximately 25,000 requests per day. Each "Both" audit uses 2 requests (one mobile, one desktop). Without a key the API will not work — a key is required in plugin settings.

License
-------

[](#license)

This plugin is licensed under [The Craft License](LICENSE.md).

Development
-----------

[](#development)

The project ships with a [DDEV](https://ddev.com) environment providing PHP 8.2 and MariaDB 10.11. The integration suite needs the database, so run everything through it:

```
ddev start
ddev composer install
cp tests/.env.example tests/.env
ddev exec composer test
```

### Test suites

[](#test-suites)

SuiteLocationRunnerNeeds a databaseUnit`tests/unit`PHPUnitNoIntegration`tests/integration`Codeception + CraftYesUnit tests cover the Craft-free response parsing in `ResponseParser`. Integration tests boot a real Craft installation with the plugin loaded to exercise the plugin lifecycle, settings, widget, service, and controller.

Run them individually with:

```
ddev exec composer test:unit
ddev exec composer test:integration
```

The integration suite installs Craft into the DDEV database and drops all its tables between runs, so point it at a throwaway database only. Credentials live in `tests/.env`, which is untracked — copy `tests/.env.example` to create it.

Static analysis and code style checks:

```
ddev exec composer phpstan
ddev exec composer check-cs
```

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance95

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

46d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/035cb655c55af0e9e5b96754b80fd9703e195c32dbdfc49ae9a43ab9cf8db560?d=identicon)[justinholtweb](/maintainers/justinholtweb)

---

Top Contributors

[![justinholtweb](https://avatars.githubusercontent.com/u/295903?v=4)](https://github.com/justinholtweb "justinholtweb (6 commits)")

---

Tags

performancecmsyii2craftcmscraft-pluginseolighthousePageSpeedcore-web-vitals

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/justinholtweb-craft-lightning/health.svg)

```
[![Health](https://phpackages.com/badges/justinholtweb-craft-lightning/health.svg)](https://phpackages.com/packages/justinholtweb-craft-lightning)
```

###  Alternatives

[nystudio107/craft-seomatic

SEOmatic facilitates modern SEO best practices &amp; implementation for Craft CMS 5. It is a turnkey SEO system that is comprehensive, powerful, and flexible.

1741.5M68](/packages/nystudio107-craft-seomatic)[verbb/formie

The most user-friendly forms plugin for Craft.

101393.6k74](/packages/verbb-formie)[verbb/comments

Add comments to your site.

13753.9k1](/packages/verbb-comments)[verbb/vizy

A flexible visual editor field for Craft.

4250.4k](/packages/verbb-vizy)[verbb/hyper

A user-friendly links field for Craft.

24147.8k12](/packages/verbb-hyper)[vaersaagod/seomate

SEO, mate! It's important.

4442.8k2](/packages/vaersaagod-seomate)

PHPackages © 2026

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