PHPackages                             yii2-speed/speed - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. yii2-speed/speed

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

yii2-speed/speed
================

class speed, For yii2 extention.

1.1.3(8y ago)113BSD-3-ClausePHP

Since Mar 23Pushed 8y ago1 watchersCompare

[ Source](https://github.com/cunwang/yii2-speed)[ Packagist](https://packagist.org/packages/yii2-speed/speed)[ RSS](/packages/yii2-speed-speed/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

### 实现功能

[](#实现功能)

可记录程序或方法运行中区块消耗（平均、区块、总量），记录过程中抛出的错误。 运行结果为json数据，可用于生成报表数据。

### 安装

[](#安装)

此程序可以通过composer 进行安装

```
composer require yii2-speed/speed
```

或者

在composer.json添加 `"yii2-speed/speed":"1.*"` ，然后composer update 即可。

### 运行示例

[](#运行示例)

\[1.php\]

```
//引入自动加载
require "vendor/autoload.php";

//引入全名空间
use Yii2\lib\speed;

//类实例化
$s  = new speed();

//增加一个测试区间,别名叫test1
$s->s('loop', 'test1');
sleep(1);

//增加一个测试区间,别名叫test2
$s->s('loop', 'test2');
sleep(2);

//增加一个测试区间,别名叫test3
$s->s('loop', 'test3');
sleep(1);

//结束数据收集
$s->end();

$d  = $s->data();	//返回json_encode($arr)后Json数据
$d  = $s->data('arr'); //返回数据
```

数据格式如下：

```
Array
(
 [title] => Speed-20180316115016
 [flag] =>
 [alias] => Array
 (
  [0] => Start
  [1] => test1
  [2] => test2
  [3] => test3
  [4] => End
 )

 [option] => Array
 (
  [0] => Option-5aab3ef847c1a
  [1] => Option-5aab3ef847cb9
  [2] => Option-5aab3ef947dd4
  [3] => Option-5aab3efb47efe
  [4] => Option-5aab3efc48024
 )

 [time] => Array
 (
  [0] => 1521172216.2939
  [1] => 1521172216.2941
  [2] => 1521172217.2944
  [3] => 1521172219.2947
  [4] => 1521172220.295
 )

 [optionSpeed] => Array
 (
  [0] => 0.00016
  [1] => 1.00029
  [2] => 2.00030
  [3] => 1.00029
 )

 [allSpeed] => 4.00104
 [average] => 0.800208
 )
```

以上

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

2974d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e5f7cb8f301a6dfd63d8b91aaf3dcce3b1e9ecaf1ef7ae7021d4d9c02f120525?d=identicon)[cunwang](/maintainers/cunwang)

---

Top Contributors

[![cunwang](https://avatars.githubusercontent.com/u/6813628?v=4)](https://github.com/cunwang "cunwang (14 commits)")

---

Tags

yii2extensionspeed

### Embed Badge

![Health badge](/badges/yii2-speed-speed/health.svg)

```
[![Health](https://phpackages.com/badges/yii2-speed-speed/health.svg)](https://phpackages.com/packages/yii2-speed-speed)
```

###  Alternatives

[vyants/yii2-daemon

Extension provides functionality for simple daemons creation and control

7859.0k](/packages/vyants-yii2-daemon)[dmstr/yii2-cookie-consent

Yii2 Cookie Consent Widget

1452.6k](/packages/dmstr-yii2-cookie-consent)[richardfan1126/yii2-js-register

Yii2 widget to register JS into view

1357.2k7](/packages/richardfan1126-yii2-js-register)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
