{"id":15821297,"url":"https://github.com/octoper/lighthouse-php","last_synced_at":"2025-09-12T17:31:21.299Z","repository":{"id":55858334,"uuid":"271016017","full_name":"octoper/lighthouse-php","owner":"octoper","description":"A PHP interface for Google Lighthouse","archived":false,"fork":false,"pushed_at":"2020-12-29T16:16:02.000Z","size":87,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-18T06:32:14.602Z","etag":null,"topics":["google-lighthouse","lighthouse","lighthouse-php"],"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/octoper.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":null},"funding":{"github":"octoper"}},"created_at":"2020-06-09T13:52:21.000Z","updated_at":"2023-03-07T12:52:34.000Z","dependencies_parsed_at":"2022-08-15T08:00:17.082Z","dependency_job_id":null,"html_url":"https://github.com/octoper/lighthouse-php","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/octoper/lighthouse-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octoper%2Flighthouse-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octoper%2Flighthouse-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octoper%2Flighthouse-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octoper%2Flighthouse-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/octoper","download_url":"https://codeload.github.com/octoper/lighthouse-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octoper%2Flighthouse-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274847400,"owners_count":25360978,"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","status":"online","status_checked_at":"2025-09-12T02:00:09.324Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["google-lighthouse","lighthouse","lighthouse-php"],"created_at":"2024-10-05T07:21:29.319Z","updated_at":"2025-09-12T17:31:20.872Z","avatar_url":"https://github.com/octoper.png","language":"PHP","funding_links":["https://github.com/sponsors/octoper"],"categories":[],"sub_categories":[],"readme":"# Lighthouse\n\n[![Tests](https://github.com/octoper/lighthouse-php/workflows/Tests/badge.svg)](https://github.com/octoper/lighthouse-php/actions?query=workflow%3ATests)\n[![StyleCI](https://github.styleci.io/repos/271016017/shield?style=square)](https://github.styleci.io/repos/271016017)\n[![Packagist Version](https://img.shields.io/packagist/v/octoper/lighthouse-php)](https://packagist.org/packages/octoper/lighthouse-php)\n[![Packagist Downloads](https://img.shields.io/packagist/dm/octoper/lighthouse-php)](https://packagist.org/packages/octoper/lighthouse-php)\n[![License](https://img.shields.io/github/license/octoper/lighthouse-php)](LICENSE.md)\n\n\n**This package is a fork of** [dzava/lighthouse-php](https://github.com/dzava/lighthouse-php)\n\nThis package provides a PHP interface for [Google Lighthouse](https://github.com/GoogleChrome/lighthouse).\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require octoper/lighthouse-php\n```\n\n## Usage\n\nHere's an example that will perform the default Lighthouse audits and store the result in `report.json` (You can use the [Lighthouse Viewer](https://googlechrome.github.io/lighthouse/viewer/) to open the report):\n\n```php\nuse Octoper\\Lighthouse\\Lighthouse;\n\n(new Lighthouse())\n    -\u003esetOutput('report.json')\n    -\u003eaccessibility()\n    -\u003ebestPractices()\n    -\u003eperformance()\n    -\u003epwa()\n    -\u003eseo()\n    -\u003eaudit('http://example.com');\n```\n\n### Output\n\nThe `setOutput` method accepts a second argument that can be used to specify the format (json,html).\nIf the format argument is missing then the file extension will be used to determine the output format.\nIf the file extension does not specify an accepted format, then json will be used.\n\nYou can output both the json and html reports by passing an array as the second argument. For the example\nthe following code will create two reports `example.report.html` and `example.report.json`.\n\n```php\nuse Octoper\\Lighthouse\\Lighthouse;\n\n(new Lighthouse())\n    -\u003esetOutput('example', ['html', 'json'])\n    -\u003eperformance()\n    -\u003eaudit('http://example.com');\n```\n\n### Using a custom config\n\nYou can provide your own configuration file using the `withConfig` method.\n```php\nuse Octoper\\Lighthouse\\Lighthouse;\n\n(new Lighthouse())\n    -\u003ewithConfig('./my-config.js')\n    -\u003eaudit('http://example.com');\n```\n\n### Customizing node and Lighthouse paths\n\nIf you need to manually set these paths, you can do this by calling the `setNodeBinary` and `setLighthousePath` methods.\n\n```php\nuse Octoper\\Lighthouse\\Lighthouse;\n\n(new Lighthouse())\n    -\u003esetNodeBinary('/usr/bin/node')\n    -\u003esetLighthousePath('./lighthouse.js')\n    -\u003eaudit('http://example.com');\n```\n\n### Passing flags to Chrome\nUse the `setChromeFlags` method to pass any flags to the Chrome instance.\n```php\nuse Octoper\\Lighthouse\\Lighthouse;\n\n(new Lighthouse())\n    // these are the default flags used\n    -\u003esetChromeFlags(['--headless', '--disable-gpu', '--no-sandbox'])\n    -\u003eaudit('http://example.com');\n```\n\n## Testing\n\n``` bash\ncomposer test\n```\n\n## Security\n\nIf you discover any security related issues, please email me@octoper.me instead of using the issue tracker.\n\n## Credits\n\n- [dzava](https://github.com/dzava)\n- [octoper](https://github.com/octoper)\n- [All Contributors](../../contributors)\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%2Foctoper%2Flighthouse-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foctoper%2Flighthouse-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foctoper%2Flighthouse-php/lists"}