giraffesummer/stopwatch 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

giraffesummer/stopwatch

最新稳定版本:1.0.7

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.

统计信息

  • 总下载量: 259
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2022-10-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固