{"id":19325092,"url":"https://github.com/spatie/lighthouse-php","last_synced_at":"2025-04-04T08:05:55.358Z","repository":{"id":62685482,"uuid":"561688703","full_name":"spatie/lighthouse-php","owner":"spatie","description":"Run Google Lighthouse using PHP","archived":false,"fork":false,"pushed_at":"2024-04-29T11:33:21.000Z","size":747,"stargazers_count":223,"open_issues_count":2,"forks_count":22,"subscribers_count":10,"default_branch":"main","last_synced_at":"2024-05-01T11:46:07.002Z","etag":null,"topics":["best-practices","google","lighthouse","performance","php","seo"],"latest_commit_sha":null,"homepage":"https://spatie.be/docs/lighthouse-php","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/spatie.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":"docs/support-us.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"spatie"}},"created_at":"2022-11-04T09:05:53.000Z","updated_at":"2024-05-06T09:48:23.410Z","dependencies_parsed_at":"2024-03-12T00:39:14.583Z","dependency_job_id":"b3a883dd-34dd-4efb-9c55-5267fe0f6349","html_url":"https://github.com/spatie/lighthouse-php","commit_stats":{"total_commits":121,"total_committers":8,"mean_commits":15.125,"dds":0.4380165289256198,"last_synced_commit":"ba385cce61a50a0d4e6d618e35ab078a3bd43969"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":"spatie/package-skeleton-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Flighthouse-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Flighthouse-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Flighthouse-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Flighthouse-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spatie","download_url":"https://codeload.github.com/spatie/lighthouse-php/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247141448,"owners_count":20890628,"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":["best-practices","google","lighthouse","performance","php","seo"],"created_at":"2024-11-10T02:08:51.188Z","updated_at":"2025-04-04T08:05:55.338Z","avatar_url":"https://github.com/spatie.png","language":"PHP","funding_links":["https://github.com/sponsors/spatie"],"categories":[],"sub_categories":[],"readme":"# Run Google Lighthouse using PHP\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/spatie/lighthouse-php.svg?style=flat-square)](https://packagist.org/packages/spatie/lighthouse-php)\n[![Tests](https://github.com/spatie/lighthouse-php/actions/workflows/run-tests.yml/badge.svg?branch=main)](https://github.com/spatie/lighthouse-php/actions/workflows/run-tests.yml)\n[![Total Downloads](https://img.shields.io/packagist/dt/spatie/lighthouse-php.svg?style=flat-square)](https://packagist.org/packages/spatie/lighthouse-php)\n\n[Google Lighthouse](https://developer.chrome.com/docs/lighthouse/overview/) is an open-source, automated tool for improving the quality of web pages. It has audits for performance, accessibility, progressive web apps, SEO and more.\n\nThis package makes it easy to run Lighthouse using PHP. Here's an example on how to get the scores of the five categories of audits that Lighthouse offers.\n\n```php\nuse Spatie\\Lighthouse\\Lighthouse;\n\n// returns an instance of Spatie\\Lighthouse\\LighthouseResult\n$result = Lighthouse::url('https://example.com')-\u003erun();\n\n$result-\u003escores(); // returns an array like this one:\n/*\n * [\n *    'performance' =\u003e 98,\n *    'accessibility' =\u003e 83,\n *    'best-practices' =\u003e 90,\n *    'seo' =\u003e 92,\n *    'pwa' =\u003e 43,  \n * ]\n */\n```\n\nIt's easy to configure various options:\n\n```php\nuse Spatie\\Lighthouse\\Lighthouse;\nuse Spatie\\Lighthouse\\Enums\\Category;\n\nLighthouse::url('https://example.com')\n    -\u003euserAgent('My user agent')\n    -\u003eheaders(['MyExtraHeader' =\u003e 'HeaderValue'])\n    -\u003ecategories(Category::Performance, Category::Accessibility)\n    -\u003ethrottleCpu()\n    -\u003erun();\n```\n\nHere's how you can get the results of an audit:\n\n```php\n$result-\u003eaudit('first-contentful-paint') // returns this array\n\n/*\n * [\n *     'id' =\u003e 'first-contentful-paint'\n *     'title' =\u003e 'First Contentful Paint'\n *     'score' =\u003e 0.98\n *     'scoreDisplayMode' =\u003e 'numeric'\n *     'numericValue' =\u003e 1262.95\n *     'numericUnit' =\u003e 'millisecond'\n *     'displayValue' =\u003e '1.3 s'\n * ]\n */\n```\n\nYou can also write a full HTML report to disk:\n\n```php\n$result-\u003esaveHtml($pathToReport)\n```\n\n## Support us\n\n[\u003cimg src=\"https://github-ads.s3.eu-central-1.amazonaws.com/lighthouse-php.jpg?t=1\" width=\"419px\" /\u003e](https://spatie.be/github-ad-click/lighthouse-php)\n\nWe invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).\n\nWe highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).\n\n## Documentation\n\nAll documentation is available [on our documentation site](https://spatie.be/docs/lighthouse-php).\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Credits\n\n- [Freek Van der Herten](https://github.com/freekmurze)\n- [All Contributors](../../contributors)\n\nThis package contains code copied from [Laravel's `Arr` class](https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Arr.php).\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspatie%2Flighthouse-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspatie%2Flighthouse-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspatie%2Flighthouse-php/lists"}