定制 justinholtweb/craft-lightning 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

justinholtweb/craft-lightning

最新稳定版本:5.0.0

Composer 安装命令:

composer require 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.

README 文档

README

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

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 & Desktop — audit both strategies with a tabbed interface
  • Environment variable support — store your API key in .env

Requirements

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

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 > Plugins.

Setup

  1. Get a free API key from the Google Cloud Console
  2. Enable the PageSpeed Insights API in your Google Cloud project
  3. In the Craft control panel, go to Settings > 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

Add to your .env file:

GOOGLE_PSI_API_KEY=your-key-here

Then enter $GOOGLE_PSI_API_KEY in the plugin settings.

Usage

Dashboard Widget

  1. Go to the Dashboard
  2. Click New Widget > 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

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 follow Google's thresholds:

Range Rating
90–100 Good (green)
50–89 Needs Improvement (orange)
0–49 Poor (red)

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

This plugin is licensed under The Craft License.

Development

Install dependencies and run the test suite:

composer install
composer test

Static analysis and code style checks are also available:

composer phpstan
composer check-cs

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2026-06-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固