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

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

firecms-ext/utils
=================

hyperf 扩展：常用工具函数

1616PHP

Since Dec 11Pushed 3y agoCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

firecms-ext/utils
=================

[](#firecms-extutils)

```
# 依赖安装
composer require firecms-ext/utils
```

函数列表
====

[](#函数列表)

```
# Cache 对象
function cache(): CacheInterface;

# Redis 对象
function redis(): Redis;

# 生成主键
function generateId(): string;

# 计算年龄
function age(string $birthday): int;

# 生成 uuid
function uuid(string $prefix = ''): string;

# 文件大小格式化
function filesizeFormat(int $filesize): string;

# array 转 tree
function toTree(array $rows, string $pid = 'parent_id', string $id = 'id', string $children = 'children'): array;

# 普通 tree 转 tree 下拉选项
function treeToOptions(array $tree, string $label = 'title', string $value = 'id', string $children = 'children'): array;

# 下拉选项
function options(array $rows, ?string $label = 'title', ?string $value = 'id'): array;

# 分组下拉选项
function groupOptions(array $groups, ?string $label = 'title', ?string $value = 'id'): array;

# 净化 HTML 字符串
function purifyHtml(string $html, HTMLPurifier_Config $config = null): string;
```

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity24

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/4a621d9d09087893e4f566f3101143490a234cd75234d3a34f7c8069c280f370?d=identicon)[WenKaiYang](/maintainers/WenKaiYang)

---

Top Contributors

[![WenKaiYang](https://avatars.githubusercontent.com/u/25893287?v=4)](https://github.com/WenKaiYang "WenKaiYang (257 commits)")

### Embed Badge

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

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

PHPackages © 2026

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