giraffesummer/stopwatch
Composer 安装命令:
composer require giraffesummer/stopwatch
包简介
README 文档
README
Install: composer require giraffesummer/stopwatch
Time your functions, commands and tasks stopwatch style using this package.
It's build with Laravel (9) in mind, but it might work without it.
It's super easy to get started, there's only 3 functions:
Getting started
You can start using the stopwatch by creating a new instance of it.
import GiraffeSummer\Stopwatch\Stopwatch
use GiraffeSummer\Stopwatch\Stopwatch; $sw = new Stopwatch();
Functions
The functions Start and Lap will return a formatted time string.
Start
Start will return the starting time of the stopwatch.
This should always be: 00:00:00.000
usage:
$sw->start(); //00:00:00.000
Lap
Lap is equivalent to the lap button on a stopwatch,
this will show the current elapsed time of the stopwatch,
since it was started or reset.
usage:
$sw->lap(); //00:00:05.9547
Reset
Reset will reset the time back to 0.
usage:
$sw->reset();
Example
here's an example of it all together.
$sw = new Stopwatch(); echo $sw->start(); $sleep = rand(1, 5); echo "sleep: " . $sleep; sleep($sleep); echo $sw->lap();
This will sleep for a random number of seconds between 1 and 5, and lap before and after to see how long it was.
giraffesummer/stopwatch 适用场景与选型建议
giraffesummer/stopwatch 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 261 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 10 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 giraffesummer/stopwatch 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 giraffesummer/stopwatch 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 261
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2022-10-14