PHPackages                             shayvmo/shayvmo-utils - 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. shayvmo/shayvmo-utils

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

shayvmo/shayvmo-utils
=====================

PHP工具包

v1.0.4(1y ago)031MITPHPPHP &gt;=7.0

Since May 24Pushed 1y ago1 watchersCompare

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

READMEChangelog (3)Dependencies (1)Versions (5)Used By (0)

PHP常用开发工具包
----------

[](#php常用开发工具包)

受 [Hutool](https://hutool.cn/) 启发，于是整理一个PHP开发工具包，欢迎大家共建，完善。

### 使用

[](#使用)

```
composer require shayvmo/shayvmo-utils

```

### 日期时间 DateUtil 类

[](#日期时间-dateutil-类)

#### 返回DateTime

[](#返回datetime)

```
// 返回DateTime
DateUtil::date(); // 返回当前时间
DateUtil::date(time()); // 也可以指定时间戳

```

#### 格式化日期

[](#格式化日期)

```
// 返回常用格式日期 Y-m-d H:i:s
DateUtil::format(); // 返回当前时间
DateUtil::format(time()); // 也可以指定时间戳

// 自定义格式化日期
DateUtil::formatCustom(time(), "c");// 2024-05-23T18:23:56+08:00
DateUtil::formatDate();// Y-m-d
DateUtil::formatTime();// H:i:s
DateUtil::formatISO();// 2024-05-23T18:23:56+08:00

```

#### 开始和结束时间

[](#开始和结束时间)

```
// 一天开始和结束时间
DateUtil::beginOfDay(time());// 2024-05-24 00:00:00
DateUtil::endOfDay(time());// 2024-05-24 23:59:59

```

#### 日期时间偏移

[](#日期时间偏移)

```
// 一年后
DateUtil::offset("2024-05-24 10:00:00", DateField::YEAR, 1);

// 一天后
DateUtil::offsetDay("2024-05-24 10:00:00", 1);

//昨天
DateUtil.yesterday();
//明天
DateUtil.tomorrow();
//上周
DateUtil.lastWeek();
//下周
DateUtil.nextWeek();
//上个月
DateUtil.lastMonth();
//下个月
DateUtil.nextMonth();

```

#### 日期时间差

[](#日期时间差)

有时候我们希望看到易读的时间差，比如XX天XX小时XX分XX秒，此时使用`DateUtil::formatBetween`方法

```
// 相差天数
DateUtil::between(strtotime("2024-05-01"), strtotime("2024-05-03"), DateUnit::DAY);

// DateLevel::SECOND 表示精确到秒
DateUtil::formatBetween(500, DateLevel::SECOND);// 8分钟19秒

```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 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 ~1 days

Total

4

Last Release

719d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0230099957ac637eae0dfc897bdf56416c1847dedd1a4168b8432889723f02aa?d=identicon)[shayvmo](/maintainers/shayvmo)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/shayvmo-shayvmo-utils/health.svg)

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

###  Alternatives

[felixnagel/t3extblog

A record based blog extension for TYPO3 CMS. Easy to use and packed with features (incl. comments, subscriptions for comments and posts, Wordpress like subscription manager, reasonable email sending in FE and BE, GDPR ready, BE modules, Dashboard widgets, RSS, Sitemap, ...). Flexible and powerful!

3421.6k](/packages/felixnagel-t3extblog)

PHPackages © 2026

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