PHPackages                             qq171787869/think-helper - 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. qq171787869/think-helper

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

qq171787869/think-helper
========================

based on topthink/think-helper=1.0.7

22.1.1(4y ago)010Apache-2.0PHPPHP &gt;=5.6.0

Since Dec 2Pushed 4y ago1 watchersCompare

[ Source](https://github.com/qq171787869/think-helper)[ Packagist](https://packagist.org/packages/qq171787869/think-helper)[ RSS](/packages/qq171787869-think-helper/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)DependenciesVersions (3)Used By (0)

thinkphp5 常用的一些扩展类库
-------------------

[](#thinkphp5-常用的一些扩展类库)

> 以下类库都在`\think\helper`命名空间下

Str 字符串操作
---------

[](#str-字符串操作)

```
// 检查字符串中是否包含某些字符串
Str::contains('我是中国人', '我是');			// true
Str::contains('我是中国人', ['我', '啊'])	;	// true

// 检查字符串是否以某些字符串结尾
Str::endsWith('我是中国人', '中国人')	;		// true
Str::endsWith('我是中国人', ['国', '人'])	;	// true

// 检查字符串是否以某些字符串开头
Str::endsWith('我是中国人', '我是');			// true
Str::endsWith('我是中国人', ['我', '是'])	;	// true

// 获取指定长度的随机字母数字组合的字符串
Str::random(8);			// 'xjBIKyRH'

// 字符串转小写
Str::lower('Abcd');		// 'abcd'

// 字符串转大写
Str::upper('abcd');		// 'ABCD'

// 获取字符串的长度
Str::length('abcd');	// 4

// 截取字符串
Str::substr($string, $start, $length = null);
Str::substr('abcdefg', 2, 3);	// 'cde'

// 驼峰转下划线
Str::snake($value, $delimiter = '_');
Str::snake('AbcDef');			// 'abc_def'

// 下划线(_/-)转驼峰(首字母小写)
Str::camel('abc_def');			// 'abcDef'

// 下划线(_/-)转驼峰(首字母大写)
Str::camel('abc_def');			// 'AbcDef'

// 转为首字母大写的标题格式
Str::title('abc_def');			// 'Abc_Def'
Str::title('abc-def');			// 'Abc-Def'

```

Hash 创建密码的哈希 $type默认为bcrypt
---------------------------

[](#hash-创建密码的哈希-type默认为bcrypt)

```
// 创建
Hash::make($value, $type = null, array $options = []);
Hash::make($value, 'md5', ['salt' = 'qq171787869']);

// 检查
Hash::check($value, $hashedValue, $type = null, array $options = []);
Hash::make($value, 'd1a53cf421c3f7466c4313dc5b87b50a', 'md5', ['salt' = 'qq171787869']);

```

Time 时间戳操作
----------

[](#time-时间戳操作)

> 注意设置时区 date\_default\_timezone\_set('PRC');

```
// 今日开始和结束的时间戳
Time::today();		// [1637884800, 1637971199]

// 昨日开始和结束的时间戳
Time::yesterday();	// 同上

// 本周开始和结束的时间戳
Time::week();		// 同上

// 上周开始和结束的时间戳
Time::lastWeek();	// 同上

// 本月开始和结束的时间戳
Time::month();		// 同上

// 上月开始和结束的时间戳
Time::lastMonth();	// 同上

// 今年开始和结束的时间戳
Time::year();		// 同上

// 去年开始和结束的时间戳
Time::lastYear();	// 同上

// 获取7天前零点到现在的时间戳
Time::dayToNow(7)	// 同上

// 获取7天前零点到昨日结束的时间戳
Time::dayToNow(7, false)	// 同上

// 获取7天前的时间戳
Time::daysAgo(7) 		// 1637321689

//  获取7天后的时间戳
Time::daysAfter(7)		// 同上

// 天数转换成秒数
Time::daysToSecond(5) 	// 432000

// 周数转换成秒数
Time::weekToSecond(1) 	// 604800

```

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 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

1675d ago

Major Versions

1.0.0 → 22.1.12021-12-02

### Community

Maintainers

![](https://www.gravatar.com/avatar/3aff4bfb5e082193ef0537c9d5b154b26367f3e6f8bee5b511327e0ec7b6b852?d=identicon)[qq171787869](/maintainers/qq171787869)

---

Top Contributors

[![qq171787869](https://avatars.githubusercontent.com/u/23153351?v=4)](https://github.com/qq171787869 "qq171787869 (1 commits)")

### Embed Badge

![Health badge](/badges/qq171787869-think-helper/health.svg)

```
[![Health](https://phpackages.com/badges/qq171787869-think-helper/health.svg)](https://phpackages.com/packages/qq171787869-think-helper)
```

###  Alternatives

[luchavez/boilerplate-generator

A boilerplate generator for building packages and implementing DDD on Laravel 8|9|10.

121.7k2](/packages/luchavez-boilerplate-generator)

PHPackages © 2026

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