inforob-sf / pagespeed-toolkit
Google PageSpeed Insights audit and AI-powered fix toolkit for Symfony projects
Package info
github.com/inforob-sf/pagespeed-toolkit
Type:composer-plugin
pkg:composer/inforob-sf/pagespeed-toolkit
Requires
- php: >=8.2
- composer-plugin-api: ^2.0
- symfony/console: ^6.4|^7.0|^8.0
- symfony/framework-bundle: ^6.4|^7.0|^8.0
- symfony/http-client: ^6.4|^7.0|^8.0
Requires (Dev)
- composer/composer: ^2.0
- phpunit/phpunit: ^11.0
This package is auto-updated.
Last update: 2026-07-22 19:41:12 UTC
README
A Composer-installable Symfony Bundle + Claude Code toolkit for achieving 90-100 PageSpeed scores.
It combines a Symfony Bundle with a console command that generates audit reports, an AI agent that analyzes your project and recommends optimizations, and a slash command that reads audit reports and applies fixes interactively.
Symfony Installation
composer require inforob-sf/pagespeed-toolkit
That's it. The package automatically:
- Registers
PageSpeedBundleinconfig/bundles.php - Creates
config/packages/pagespeed.yamlwith default configuration - Adds
PAGESPEED_API_KEYandSITE_URLplaceholders to.env - Copies
/pagespeed-fixand thepagespeed-optimizeragent into.claude/
The only manual step: fill in your API key in .env.local:
PAGESPEED_API_KEY=your_google_api_key_here SITE_URL=https://your-site.com
How it works
┌─────────────────────────────────────────────────────────────────┐
│ 1. AUDIT │
│ Run an audit command → generates pagespeed-report.json │
│ • Symfony: php bin/console pagespeed:audit │
│ • Any stack: ./integrations/shell/pagespeed-audit.sh <url> │
├─────────────────────────────────────────────────────────────────┤
│ 2. FIX (Claude Code) │
│ /pagespeed-fix → Claude reads the report, shows failing │
│ audits, and applies fixes one by one with your confirmation │
├─────────────────────────────────────────────────────────────────┤
│ 3. REVIEW (Claude Code) │
│ pagespeed-optimizer agent → deep analysis of NGINX config, │
│ Core Web Vitals, and framework-specific optimizations │
└─────────────────────────────────────────────────────────────────┘
Installation
1. Copy the Claude Code files into your project
# From the root of your project cp -r /path/to/claude-pagespeed-toolkit/.claude .
Or copy manually:
.claude/agents/pagespeed-optimizer.md→ your project's.claude/agents/.claude/commands/pagespeed-fix.md→ your project's.claude/commands/
2. Set up the audit integration for your framework
| Framework | Instructions |
|---|---|
| Symfony | See integrations/symfony/README.md |
| Any stack | See integrations/shell/README.md |
| Laravel | Coming soon |
| Next.js | Coming soon |
| WordPress | Coming soon |
3. Get a Google PageSpeed API key
- Go to Google Cloud Console
- Enable the PageSpeed Insights API
- Create an API key
- Add it to your environment:
PAGESPEED_API_KEY=your_key_here
The free tier allows ~25,000 requests/day — more than enough for local development.
Shell Script (Universal)
Works with any framework. Requires curl and jq.
chmod +x integrations/shell/pagespeed-audit.sh # Basic usage PAGESPEED_API_KEY=your_key ./integrations/shell/pagespeed-audit.sh https://your-site.com # Audit specific pages PAGESPEED_API_KEY=your_key ./integrations/shell/pagespeed-audit.sh https://your-site.com \ --urls /,/blog,/about \ --strategy both \ --output pagespeed-report.json
Usage
/pagespeed-fix — Interactive fixer
Open Claude Code in your project and run:
/pagespeed-fix
Claude will:
- Detect your framework automatically
- Locate or generate the audit report
- Show failing audits grouped by category and impact
- Ask which ones you want to fix
- Apply each fix with minimum-necessary changes, reading the file first
- Show a summary of changes and manual action items
pagespeed-optimizer agent — Deep analysis
Ask Claude to launch the optimizer agent for a comprehensive review:
"Can you check if my project is optimized for PageSpeed?"
The agent will:
- Detect your stack and existing configurations
- Audit NGINX config, frontend assets, and Core Web Vitals
- Deliver copy-paste-ready fixes with before/after score estimates
Supported frameworks
| Framework | Audit command | Fix coverage |
|---|---|---|
| Symfony + Twig | php bin/console pagespeed:audit |
Full (Twig templates, NGINX, CSS) |
| Any stack | pagespeed-audit.sh |
Full (NGINX, HTML, CSS, JS) |
| Laravel + Blade | Coming soon | — |
| Next.js | Coming soon | — |
| WordPress | Coming soon | — |
Contributing
Contributions are welcome. The most valuable additions are:
- New framework integrations — add a folder under
integrations/with the audit command and a README - Fix guide entries — extend the fix table in
.claude/commands/pagespeed-fix.mdwith framework-specific fixes - Agent improvements — refine the optimizer agent's detection or output format
See docs/contributing.md for details.
License
MIT