agonyz / contao-page-speed-insights-bundle
自动获取页面速度洞察
2.0.2
2023-07-15 14:45 UTC
Requires
- php: ^7.4 || ^8.0
- babdev/pagerfanta-bundle: ^3.7
- contao/core-bundle: ^4.13
- guzzlehttp/guzzle: ^7.4
- pagerfanta/doctrine-orm-adapter: ^3.6
- pagerfanta/twig: ^3.6
Requires (Dev)
- bamarni/composer-bin-plugin: ^1.5
- contao/easy-coding-standard: ^5.3
- contao/manager-plugin: ^2.0
- phpunit/phpunit: ^9.5
- symfony/phpunit-bridge: ^6.1
Conflicts
- contao/manager-plugin: <2.0 || >=3.0
README
Contao CMS 扩展
此扩展可用于自动跟踪您的根域的页面速度洞察。
快速设置请点击此链接: 快速设置指南
安装
在您的 CLI 中运行 composer require agonyz/contao-page-speed-insights-bundle
以安装此扩展。
配置
要使用 页面速度洞察 API,您需要注册一个 API 密钥。
您可以在 config/config.yml
中编辑配置。
# config/config.yml # Agonyz Page Speed Insights agonyz_contao_page_speed_insights: api_key: your-secret-api-key request_retries: 3 # retries for each strategy (desktop & mobile) pool_request_concurrency: 10 # indicates how many requests are sent simultaneously request_pagination: 15 # indicates how many requests are shown in the overview per page request_status_refresh_rate: 5000 # duration for the ajax request to check the status of the current process
请记住,每次更改 config.yml
后都要清除缓存。
还可能需要通过命令删除配置文件更改后的缓存结果。
选择要跟踪的页面
在根页面配置中,转到 Page Speed Insights Bundle
并勾选复选框。
命令 & Cronjob
命令
agonyz-page-speed-insights:request
- 生成新的请求结果并将其保存到数据库中
Cronjob
您可以选择实现自己的 cronjob 或使用 contao cron。
通过命令
- 创建一个 cronjob 来执行
agonyz-page-speed-insights:request
- 命令
通过 Cron
- 在您的
config/services.yml
中配置Agonyz\ContaoPageSpeedInsightsBundle\Cron\PageSpeedInsightsCron
示例
# Cronjob services: Agonyz\ContaoPageSpeedInsightsBundle\Cron\PageSpeedInsightsCron: tags: - name: contao.cronjob interval: '0 */24 * * *' arguments: [ '@contao.framework', '@Agonyz\ContaoPageSpeedInsightsBundle\Service\Request\RequestHandler']
文档: https://docs.contao.org/dev/framework/cron/#using-service-tagging
页面速度洞察
在后台导航到 Pagespeed-Insights
- 入口点。