seasidecrab/laravel-running-time

使用 Laravel 的请求执行时间统计工具

v1.1.6 2022-11-08 08:22 UTC

This package is auto-updated.

Last update: 2024-09-21 13:05:44 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License

Image

更新

兼容 5.3 以下版本用法

$options = app()::VERSION >= '5.3' ? $this->options() : $this->option();

安装

composer require seasidecrab/laravel-running-time ^1.1

配置

  1. 打开您的 app/Http/Kernel.php 文件,并将以下内容添加到 $middleware 数组中

    \RunningTime\Middleware\RunningTimeMiddleware::class,

    打开您的 config/app.php 文件,并将以下内容添加到 providers 数组中

    RunningTime\RunningTimeServiceProvider::class,
  2. 运行以下命令以发布包配置文件 config/runningtime.php

    php artisan vendor:publish --provider='RunningTime\RunningTimeServiceProvider'
  • 如果您想以批处理模式运行,这需要 redis。打开您的 config/runningtime.php

    'mode' => 'delay',
  • 如果运行命令后内存不足,打开您的 config/runningtime.php

    'memory_limit' => '512M', //Modify to the appropriate value

    或者使用 --lessMemory 运行命令

用法

简单用法

#This will count the last 7 days of data
php artisan running-time

#This will show the top 20 path
php artisan running-time --line=20

php artisan running-time --start=2019-03-03

php artisan running-time --start='1 month ago'

php artisan running-time --path='your path'

#Significantly reduce memory usage but increase time spent
php artisan running-time --lessMemory

选项

--line  Maximum number of displayed lines
--start Statistical start time
--end   Statistical end time
--path  Statistical path runtime
--lessMemory Significantly reduce memory usage and increase time spent

清理日志文件

简单用法

php artisan running-time:clear --all

php artisan running-time:clear --recent=30

待办事项列表

  • 网页

许可证

laravel-running-time 是一个开源软件,许可协议为 MIT 协议。