octoper/lighthouse-php
Composer 安装命令:
composer require octoper/lighthouse-php
包简介
Interface for the Google Lighthouse
关键字:
README 文档
README
This package is a fork of dzava/lighthouse-php
This package provides a PHP interface for Google Lighthouse.
Installation
You can install the package via composer:
composer require octoper/lighthouse-php
Usage
Here's an example that will perform the default Lighthouse audits and store the result in report.json (You can use the Lighthouse Viewer to open the report):
use Octoper\Lighthouse\Lighthouse; (new Lighthouse()) ->setOutput('report.json') ->accessibility() ->bestPractices() ->performance() ->pwa() ->seo() ->audit('http://example.com');
Output
The setOutput method accepts a second argument that can be used to specify the format (json,html).
If the format argument is missing then the file extension will be used to determine the output format.
If the file extension does not specify an accepted format, then json will be used.
You can output both the json and html reports by passing an array as the second argument. For the example
the following code will create two reports example.report.html and example.report.json.
use Octoper\Lighthouse\Lighthouse; (new Lighthouse()) ->setOutput('example', ['html', 'json']) ->performance() ->audit('http://example.com');
Using a custom config
You can provide your own configuration file using the withConfig method.
use Octoper\Lighthouse\Lighthouse; (new Lighthouse()) ->withConfig('./my-config.js') ->audit('http://example.com');
Customizing node and Lighthouse paths
If you need to manually set these paths, you can do this by calling the setNodeBinary and setLighthousePath methods.
use Octoper\Lighthouse\Lighthouse; (new Lighthouse()) ->setNodeBinary('/usr/bin/node') ->setLighthousePath('./lighthouse.js') ->audit('http://example.com');
Passing flags to Chrome
Use the setChromeFlags method to pass any flags to the Chrome instance.
use Octoper\Lighthouse\Lighthouse; (new Lighthouse()) // these are the default flags used ->setChromeFlags(['--headless', '--disable-gpu', '--no-sandbox']) ->audit('http://example.com');
Testing
composer test
Security
If you discover any security related issues, please email me@octoper.me instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
octoper/lighthouse-php 适用场景与选型建议
octoper/lighthouse-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 860 次下载、GitHub Stars 达 4, 最近一次更新时间为 2020 年 06 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「lighthouse」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 octoper/lighthouse-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 octoper/lighthouse-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 octoper/lighthouse-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Lighthouse GraphQL Directives for Paperclip attachment support
Adds the missing category handler that was removed from Lighthouse 6.0
Interface for the Google Lighthouse project
Interface for the Google Lighthouse project
Google lighthouse for Robo Task Runner
Adds translatable directive for automatic schema generation for translatable fields
统计信息
- 总下载量: 860
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-06-09