PHPackages                             smnandre/pagespeed-api - 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. [API Development](/categories/api)
4. /
5. smnandre/pagespeed-api

ActiveLibrary[API Development](/categories/api)

smnandre/pagespeed-api
======================

PageSpeed Insight PHP Api Client 🚀 Analyse web pages for performances metrics, core web vitals...

v1.0.0(2mo ago)1511.5k—5.1%2MITPHPPHP &gt;=8.3CI passing

Since May 15Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/smnandre/pagespeed-api)[ Packagist](https://packagist.org/packages/smnandre/pagespeed-api)[ GitHub Sponsors](https://github.com/smnandre)[ RSS](/packages/smnandre-pagespeed-api/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)Dependencies (8)Versions (9)Used By (0)

🚀 PageSpeed PHP API Client
==========================

[](#-pagespeed-php-api-client)

[![PHP Version](https://camo.githubusercontent.com/b70c5d640e4c5368ff55b55a6cd756d72a500a6e32ab31c74ceea9931026b857/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2543322541307068702d253345253344253230382e332d3737374242342e7376673f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://github.com/smnandre/pagespeed-api/blob/main/composer.json)[![CI](https://github.com/smnandre/pagespeed-api/actions/workflows/CI.yaml/badge.svg)](https://github.com/smnandre/pagespeed-api/actions)[![Release](https://camo.githubusercontent.com/f8d68d4fa81f84b01c391d99b6f1b341730ff2bc9e7b8372945d492e51cd6bf3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f736d6e616e6472652f7061676573706565642d617069)](https://github.com/smnandre/pagespeed-api/releases)[![License](https://camo.githubusercontent.com/dda602601e14e76735ad79e7126d7aa3b64dd9a4a4393f9eed8479765f3bbe1e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f736d6e616e6472652f7061676573706565642d6170693f636f6c6f723d636336376666)](https://github.com/smnandre/pagespeed-api/blob/main/LICENSE)[![Codecov](https://camo.githubusercontent.com/ae0dc113ad23f3db6e06ecdd42705559437dbaa7d3f03831fdddea22e287b2c5/68747470733a2f2f636f6465636f762e696f2f67682f736d6e616e6472652f7061676573706565642d6170692f67726170682f62616467652e7376673f746f6b656e3d5243385a364634535043)](https://codecov.io/gh/smnandre/pagespeed-api)

This PHP library offers an effortless way to leverage Google's [PageSpeed Insights](https://pagespeed.web.dev/) API.

Analyze your web pages for performance metrics, get detailed reports, and optimize your site with ease. 🚀

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

[](#installation)

```
composer require smnandre/pagespeed-api
```

Usage
-----

[](#usage)

### Initialize the API

[](#initialize-the-api)

```
use PageSpeed\Api\PageSpeedApi;

$pageSpeedApi = new PageSpeedApi();

// or with API key (optional)
$pageSpeedApi = new PageSpeedApi('YOUR_API_KEY');
```

### Run analysis

[](#run-analysis)

```
// Analyze a page
$analysis = $pageSpeedApi->analyse('https://example.com/');

// ...with a specific strategy (mobile or desktop)
$analysis = $pageSpeedApi->analyse('https://example.com/', 'mobile');

// ...with a specific locale (e.g., fr_FR)
$analysis = $pageSpeedApi->analyse('https://example.com/', locale: 'fr_FR');

// ...with a specific category (performance, accessibility, best-practices, seo)
$analysis = $pageSpeedApi->analyse('https://example.com/', categories: 'performance');
```

#### Parameters

[](#parameters)

ParameterDescriptionDefault`url`The URL of the page to analyze.-`strategy`The analysis strategy to use. Possible values are `mobile` or `desktop`.`mobile``locale`The locale to use for the analysis.`en``categories`The categories to analyze. If not specified, all categories will be analyzed.-Audit Scores
------------

[](#audit-scores)

[![audit-scores.png](docs/audit-scores.png)](docs/audit-scores.png)

```
use PageSpeed\Api\PageSpeedApi;

$pageSpeedApi = new PageSpeedApi();
$analysis = $pageSpeedApi->analyse('https://www.example.com');

$scores = $analysis->getAuditScores();

// array (
//   'performance' => 100,
//   'accessibility' => 88,
//   'best-practices' => 100,
//   'seo' => 90,
// )
```

### Audit categories

[](#audit-categories)

\#CategoryDescription⚡**Performance**Measures how quickly the content on your page loads and becomes interactive.🌍**Accessibility**Evaluates how accessible your page is to users, including those with disabilities.🏆**Best Practices**Assesses your page against established web development best practices.⚓**SEO**Analyzes your page's search engine optimization, ensuring it follows SEO guidelines.### Score Evaluation

[](#score-evaluation)

MinMax⬜️Description049🟥🟥🟥🟥🟥⬜️⬜️⬜️⬜️⬜️Poor5089🟧🟧🟧🟧🟧🟧🟧🟧🟧️⬜️️Needs improvement90100🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩GoodCore Web Vitals
---------------

[](#core-web-vitals)

[![core-web-vitals.png](docs/core-web-vitals.png)](docs/core-web-vitals.png)

### Loading Metrics

[](#loading-metrics)

```
use PageSpeed\Api\PageSpeedApi;

$pageSpeedApi = new PageSpeedApi();
$analysis = $pageSpeedApi->analyse('https://www.example.com');

$metrics = $analysis->getLoadingMetrics();

// array (
//   'CUMULATIVE_LAYOUT_SHIFT_SCORE' => 'FAST',
//   'EXPERIMENTAL_TIME_TO_FIRST_BYTE' => 'AVERAGE',
//   'FIRST_CONTENTFUL_PAINT_MS' => 'FAST',
//   'FIRST_INPUT_DELAY_MS' => 'FAST',
//   'INTERACTION_TO_NEXT_PAINT' => 'FAST',
//   'LARGEST_CONTENTFUL_PAINT_MS' => 'FAST',
// )
```

### Main Metrics

[](#main-metrics)

\#AbbrMetricDescription🖼️**FCP****First Contentful Paint**Time taken for the first piece of content to appear on the screen.📏**SI****Speed Index**How quickly the contents of a page are visibly populated.📏**FID****First Input Delay**📊**CLS****Cumulative Layout Shift**Measure of visual stability; the sum of all individual layout shift scores.⏳**LCP****Largest Contentful Paint**Time taken for the largest content element to appear.⏱️**INP**Interaction to Next PaintThe time from when a user interacts with a page (e.g., clicks a button) to the next time the page visually updates in response to that interaction.Contributing
------------

[](#contributing)

Contributions are welcome! If you would like to contribute, please fork the repository and submit a pull request.

License
-------

[](#license)

This project is licensed under the MIT License. See the LICENSE file for more information.

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance88

Actively maintained with recent releases

Popularity35

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

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

Every ~112 days

Recently: every ~167 days

Total

7

Last Release

60d ago

Major Versions

v0.9.4 → v1.0.02026-03-20

### Community

Maintainers

![](https://www.gravatar.com/avatar/a8951d49b371d210280a58ce48969a07d1f49924810f8a1fab3a9343eb46fdc9?d=identicon)[simonandre](/maintainers/simonandre)

---

Top Contributors

[![smnandre](https://avatars.githubusercontent.com/u/1359581?v=4)](https://github.com/smnandre "smnandre (31 commits)")[![mwansinck](https://avatars.githubusercontent.com/u/11411864?v=4)](https://github.com/mwansinck "mwansinck (1 commits)")

---

Tags

apiapi-clientgooglegoogle-pagespeed-insightsinsightspage-speed-insightsperformancephpseospeedapiclientgoogleperformanceInsightsseoPageSpeedlightousepage-speed-insightscore-web-vitals

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/smnandre-pagespeed-api/health.svg)

```
[![Health](https://phpackages.com/badges/smnandre-pagespeed-api/health.svg)](https://phpackages.com/packages/smnandre-pagespeed-api)
```

###  Alternatives

[sgrodzicki/pagespeed

A PHP library to interact with the PageSpeed Insights API

48130.9k](/packages/sgrodzicki-pagespeed)[gemini-api-php/client

API client for Google's Gemini API

216221.4k5](/packages/gemini-api-php-client)[deepseek-php/deepseek-php-client

deepseek PHP client is a robust and community-driven PHP client library for seamless integration with the Deepseek API, offering efficient access to advanced AI and data processing capabilities.

47073.9k5](/packages/deepseek-php-deepseek-php-client)[gemini-api-php/laravel

Gemini API client for Laravel

8915.7k](/packages/gemini-api-php-laravel)[serpwow/google-search-results

Google Search Results PHP package via SerpWow.com

1931.8k1](/packages/serpwow-google-search-results)[skeeks/yii2-google-api

Component for work with google api based on google/apiclient

1243.1k1](/packages/skeeks-yii2-google-api)

PHPackages © 2026

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