{"id":19710103,"url":"https://github.com/smnandre/pagespeed-api","last_synced_at":"2025-07-18T15:33:16.814Z","repository":{"id":239791241,"uuid":"800316889","full_name":"smnandre/pagespeed-api","owner":"smnandre","description":"Google Page Speed Insight - PHP Api Client 🚀 Analyse web pages for performances metrics, core web vitals \u0026 lighthouse audits","archived":false,"fork":false,"pushed_at":"2024-07-13T16:54:59.000Z","size":1031,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-05T18:50:31.168Z","etag":null,"topics":["api","api-client","google","google-pagespeed-insights","insights","page-speed-insights","performance","php","seo","speed"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/smnandre.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["smnandre"]}},"created_at":"2024-05-14T05:29:08.000Z","updated_at":"2025-04-03T19:43:41.000Z","dependencies_parsed_at":"2024-05-17T23:29:17.417Z","dependency_job_id":"d0fc5087-518a-42a7-b225-10fb2d72812e","html_url":"https://github.com/smnandre/pagespeed-api","commit_stats":null,"previous_names":["smnandre/pagespeed-api"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smnandre%2Fpagespeed-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smnandre%2Fpagespeed-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smnandre%2Fpagespeed-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smnandre%2Fpagespeed-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smnandre","download_url":"https://codeload.github.com/smnandre/pagespeed-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251549177,"owners_count":21607365,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","api-client","google","google-pagespeed-insights","insights","page-speed-insights","performance","php","seo","speed"],"created_at":"2024-11-11T22:06:21.529Z","updated_at":"2025-04-29T17:31:09.164Z","avatar_url":"https://github.com/smnandre.png","language":"PHP","funding_links":["https://github.com/sponsors/smnandre"],"categories":[],"sub_categories":[],"readme":"# 🚀 PageSpeed PHP API Client\n\n[![PHP Version](https://img.shields.io/badge/%C2%A0php-%3E%3D%208.3-777BB4.svg?logo=php\u0026logoColor=white)](https://github.com/smnandre/pagespeed-api/blob/main/composer.json)\n[![CI](https://github.com/smnandre/pagespeed-api/actions/workflows/CI.yaml/badge.svg)](https://github.com/smnandre/pagespeed-api/actions)\n[![Release](https://img.shields.io/github/v/release/smnandre/pagespeed-api)](https://github.com/smnandre/pagespeed-api/releases)\n[![License](https://img.shields.io/github/license/smnandre/pagespeed-api?color=cc67ff)](https://github.com/smnandre/pagespeed-api/blob/main/LICENSE)\n[![Codecov](https://codecov.io/gh/smnandre/pagespeed-api/graph/badge.svg?token=RC8Z6F4SPC)](https://codecov.io/gh/smnandre/pagespeed-api)\n\nThis PHP library offers an effortless way to leverage Google's [PageSpeed Insights](https://pagespeed.web.dev/) API. \n\nAnalyze your web pages for performance metrics, get detailed reports, and optimize your site with ease. 🚀\n\n## Installation\n\n```shell\ncomposer require smnandre/pagespeed-api\n```\n\n## Usage\n\n### Initialize the API\n\n```php\nuse PageSpeed\\Api\\PageSpeedApi;\n\n$pageSpeedApi = new PageSpeedApi();\n\n// or with API key (optional)\n$pageSpeedApi = new PageSpeedApi('YOUR_API_KEY');\n```\n\n### Run analysis\n\n```php\n// Analyze a page\n$analysis = $pageSpeedApi-\u003eanalyse('https://example.com/');\n\n// ...with a specific strategy (mobile or desktop)\n$analysis = $pageSpeedApi-\u003eanalyse('https://example.com/', 'mobile');\n\n// ...with a specific locale (e.g., fr_FR)\n$analysis = $pageSpeedApi-\u003eanalyse('https://example.com/', locale: 'fr_FR');\n\n// ...with a specific category (performance, accessibility, best-practices, seo)\n$analysis = $pageSpeedApi-\u003eanalyse('https://example.com/', categories: 'performance');\n```\n\n#### Parameters\n\n| Parameter | Description                                                              | Default |\n|-----------|--------------------------------------------------------------------------|---------|\n| `url`     | The URL of the page to analyze.                                          | - |\n| `strategy` | The analysis strategy to use. Possible values are `mobile` or `desktop`. | `mobile` |\n| `locale` | The locale to use for the analysis.                                      | `en` |\n| `categories` | The categories to analyze. If not specified, all categories will be analyzed. | - |\n\n## Audit Scores\n\n![audit-scores.png](docs/audit-scores.png)\n\n```php\nuse PageSpeed\\Api\\PageSpeedApi;\n\n$pageSpeedApi = new PageSpeedApi();\n$analysis = $pageSpeedApi-\u003eanalyse('https://www.example.com');\n\n$scores = $analysis-\u003egetAuditScores();\n\n// array (\n//   'performance' =\u003e 100,\n//   'accessibility' =\u003e 88,\n//   'best-practices' =\u003e 100,\n//   'seo' =\u003e 90,\n// )\n```\n\n### Audit categories\n\n| #  | Category           | Description                                                                          |\n|----|--------------------|--------------------------------------------------------------------------------------|\n| ⚡  | **Performance**    | Measures how quickly the content on your page loads and becomes interactive.         |\n| 🌍 | **Accessibility**  | Evaluates how accessible your page is to users, including those with disabilities.   |\n| 🏆 | **Best Practices** | Assesses your page against established web development best practices.               |\n| ⚓  | **SEO**            | Analyzes your page's search engine optimization, ensuring it follows SEO guidelines. |\n\n\n### Score Evaluation\n\n| Min | Max | ⬜️                     | Description       | \n|-----|-----|------------------------|-------------------|\n| 0   | 49  | 🟥🟥🟥🟥🟥⬜️⬜️⬜️⬜️⬜️ | Poor              | \n| 50  | 89  | 🟧🟧🟧🟧🟧🟧🟧🟧🟧️⬜️️ | Needs improvement |\n| 90  | 100 | 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 | Good              |\n\n\n## Core Web Vitals\n\n![core-web-vitals.png](docs/core-web-vitals.png)\n\n### Loading Metrics\n\n```php\nuse PageSpeed\\Api\\PageSpeedApi;\n\n$pageSpeedApi = new PageSpeedApi();\n$analysis = $pageSpeedApi-\u003eanalyse('https://www.example.com');\n\n$metrics = $analysis-\u003egetLoadingMetrics();\n\n// array (\n//   'CUMULATIVE_LAYOUT_SHIFT_SCORE' =\u003e 'FAST',\n//   'EXPERIMENTAL_TIME_TO_FIRST_BYTE' =\u003e 'AVERAGE',\n//   'FIRST_CONTENTFUL_PAINT_MS' =\u003e 'FAST',\n//   'FIRST_INPUT_DELAY_MS' =\u003e 'FAST',\n//   'INTERACTION_TO_NEXT_PAINT' =\u003e 'FAST',\n//   'LARGEST_CONTENTFUL_PAINT_MS' =\u003e 'FAST',\n// )\n```\n\n### Main Metrics\n\n| # | Abbr | Metric                        | Description                                                                                      |\n|------|--------------|-------------------------------|--------------------------------------------------------------------------------------------------|\n| 🖼️   | **FCP**      | **First Contentful Paint**    | Time taken for the first piece of content to appear on the screen.                                |\n| 📏   | **SI**       | **Speed Index**               | How quickly the contents of a page are visibly populated.                                         |\n| 📏   | **FID**       | **First Input Delay**               |      |\n| 📊   | **CLS**      | **Cumulative Layout Shift**   | Measure of visual stability; the sum of all individual layout shift scores.                        |\n| ⏳   | **LCP**      | **Largest Contentful Paint**  | Time taken for the largest content element to appear.                                             |\n| ⏱️ | **INP** | Interaction to Next Paint | The 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. |\n\n\n## Contributing\n\nContributions are welcome! If you would like to contribute, please fork the repository and submit a pull request. \n\n## License\n\nThis project is licensed under the MIT License. See the LICENSE file for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmnandre%2Fpagespeed-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmnandre%2Fpagespeed-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmnandre%2Fpagespeed-api/lists"}