PHPackages                             lwi/utils2 - 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. lwi/utils2

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

lwi/utils2
==========

ThinkPHP 增强工具库

1.9.2(1y ago)079MITPHPPHP ^7.4 || ^8.0

Since Dec 4Pushed 1y ago1 watchersCompare

[ Source](https://github.com/liwanyi12/utils2)[ Packagist](https://packagist.org/packages/lwi/utils2)[ RSS](/packages/lwi-utils2/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (47)Used By (0)

$redisHelper = new RedisHelper();

$redisHelper-&gt;addScore('user1', 100); $redisHelper-&gt;addScore('user2', 200);

// 自定义过期时间 $redisHelper-&gt;addScore('user3', 300, 86400, 604800, 2592000); // 日榜 1 天，周榜 7 天，月榜 30 天

// 获取总榜前 10 名 $totalRank = $redisHelper-&gt;getRank('total', 10); print\_r($totalRank);

// 获取日榜前 5 名 $dayRank = $redisHelper-&gt;getRank('day', 5); print\_r($dayRank);

// 获取 user1 在日榜中的排名 $rank = $redisHelper-&gt;getMemberRank('day', 'user1'); if ($rank !== false) { echo "user1 在日榜中的排名是：" . ($rank + 1) . "\\n"; } else { echo "获取排名失败。\\n"; }

// 退款方法 已经测试 可以正常退款

`public function test() { $order = \[ 'transaction\_id' =&gt; '4200002602202503239383304012', 'out\_trade\_no' =&gt; '2025032310249975', 'total\_fee' =&gt; 0.01, 'refund\_fee' =&gt; 0.01, \]; $config = \[ 'app\_id' =&gt; '', 'app\_secret' =&gt; '', 'mch\_id' =&gt; '', 'mch\_key' =&gt; '', 'method' =&gt; 'Mp', 'type' =&gt; 'wechat', 'notify\_url' =&gt; '', 'cert' =&gt; 'D:/company/utils2/src/test/cert/cert/apiclient\_cert.pem', 'key' =&gt; 'D:/company/utils2/src/test/cert/cert/apiclient\_key.pem' \]; $data = (new Refund($order, $config))-&gt;refundMoney(); if($data){

return true; }

```
}`

```

$balance = "50.50"; $withdraw = 50.25; if ((new Math())-&gt;compareNumbers($balance, $withdraw) &gt;= 0) { echo "允许提款"; }

liwanyi/utils2
==============

[](#liwanyiutils2)

ThinkPHP 增强工具库

安装
--

[](#安装)

```
composer require liwanyi/utils2
```

可选依赖
----

[](#可选依赖)

- Redis支持：需安装`ext-redis`扩展
- 数据库功能：需额外安装`composer require topthink/think-orm`
- 缓存功能：需安装`composer require psr/simple-cache`

使用示例
----

[](#使用示例)

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance49

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 83.3% 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 ~11 days

Total

46

Last Release

369d ago

PHP version history (2 changes)1.0.51PHP ^7.0

1.8.8PHP ^7.4 || ^8.0

### Community

Maintainers

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

---

Top Contributors

[![000000abc](https://avatars.githubusercontent.com/u/74365003?v=4)](https://github.com/000000abc "000000abc (30 commits)")[![liwanyi123](https://avatars.githubusercontent.com/u/152691263?v=4)](https://github.com/liwanyi123 "liwanyi123 (5 commits)")[![liwanyi12](https://avatars.githubusercontent.com/u/152691717?v=4)](https://github.com/liwanyi12 "liwanyi12 (1 commits)")

### Embed Badge

![Health badge](/badges/lwi-utils2/health.svg)

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

###  Alternatives

[cleaniquecoders/shrinkr

Shrinkr is a Laravel package for shortening URLs, with custom slugs, analytics, branded domains, and seamless API integration.

142.9k](/packages/cleaniquecoders-shrinkr)

PHPackages © 2026

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