PHPackages                             lzqqdy/tools - 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. lzqqdy/tools

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

lzqqdy/tools
============

自定义php工具类

v2.27(5y ago)132143MITPHPPHP &gt;=7.0

Since Apr 10Pushed 4y ago1 watchersCompare

[ Source](https://github.com/lzqqdy/tools)[ Packagist](https://packagist.org/packages/lzqqdy/tools)[ Docs](https://www.lzqqdy.cn/)[ RSS](/packages/lzqqdy-tools/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (10)DependenciesVersions (10)Used By (0)

tools
=====

[](#tools)

===============

### 常用方法合集

[](#常用方法合集)

> 更新完善中

> 搜集平时项目中常用的方法，备份日后使用

#### 安装

[](#安装)

> composer require lzqqdy/tools

##### Demo

[](#demo)

```
use lzqqdy\tools\Http;
Http::get($url);

```

```
* 多维数组按照某字段排序  sortArrByOneField
* 多维数组格式化日期  formatDate
* 遍历文件夹获取文件树  getFilesTree
* 将数据集格式化成树形层次结构  toLayer
* 二维数组根据键值去重  unique
* 获取指定键所有值的数组  getCols
* 将一个二维数组按照指定字段的值分组  groupBy
* 从数组中删除空白的元 removeEmpty
* 获取数组层数  getArrayLevel
* curl请求Api接口  requestApi
* 由经纬度算距离  getDistance
* php将时间处理成“xx时间前”  formatTime
* 二维数组根据多个字段排序 sortArrByManyField
* 获取用户IP地址 getIp
* 将字符串分割为数组 mb_str_split
* 生成不重复的随机数 get_rand_number
* 按符号截取字符串的指定部分 cut_str
* 获取二维数组中的某一列 get_arr_column
* 多维数组转化为一维数组 array_multi2single
* 获取服务器ip地址 serverIP
* 格式化字节 formatBytes
* 生成随机颜色 randomColor
* 将一维数组解析成键值相同的数组 parseArr
* 获取本周所有日期 get_week
* 获取最近七天所有日期 get_weeks
* 一维数组转二维 toMapping
* 判断二维数组是否存在某键值对 if_array
* 数组转xml arrayToXml
* 将二维数组以指定的key作为数组的键名 convert_arr_key
* 两个数组的笛卡尔积 combineArray
* 数组随机抽出一个 arrayRandOne
* 图片转Base64 imageToBase64
* Base64保存为图片 base64ToImage
* 生成UUID uuid
* 生成订单号 createOrderNum
* 生成随机密码 getRandPass
* 手机号码中间4位用星号替换显示 hideTel
* 计算两个时间戳之间相差的时间 timeDiff
* 替换富文本编辑器中的图片地址 replacePicUrl
* ......

```

### [Arr.php](https://github.com/lzqqdy/tools/blob/master/src/Arr.php)

[](#arrphp)

> 数组处理

### [File.php](https://github.com/lzqqdy/tools/blob/master/src/File.php)

[](#filephp)

> 文件处理：文件遍历，文件&amp;文件夹操作

### [Http.php](https://github.com/lzqqdy/tools/blob/master/src/Http.php)

[](#httpphp)

> HTTP请求（get/post）

### [Random.php](https://github.com/lzqqdy/tools/blob/master/src/Random.php)

[](#randomphp)

> 随机生成

### [Str.php](https://github.com/lzqqdy/tools/blob/master/src/Str.php)

[](#strphp)

> 字符串处理

### [Time.php](https://github.com/lzqqdy/tools/blob/master/src/Time.php)

[](#timephp)

> 时间处理

### [Tree.php](https://github.com/lzqqdy/tools/blob/master/src/Tree.php)

[](#treephp)

> 数据集处理

### [Other.php](https://github.com/lzqqdy/tools/blob/master/src/Other.php)

[](#otherphp)

> 其他方法

### [WeChat.php](https://github.com/lzqqdy/tools/blob/master/src/WeChat.php)

[](#wechatphp)

> 小程序常用接口

### [Algorithm.php](https://github.com/lzqqdy/tools/blob/master/src/Algorithm.php)

[](#algorithmphp)

> PHP实现基础算法

### [Validate.php](https://github.com/lzqqdy/tools/blob/master/src/Validate.php)

[](#validatephp)

> 常用验证规则

### [Image.php](https://github.com/lzqqdy/tools/blob/master/src/Image.php)

[](#imagephp)

> 图片处理

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity60

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

Recently: every ~121 days

Total

9

Last Release

1955d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/49111fadd824ca38b1f21ef76775298541f87fef671fcbcca935b09fd63ef0c2?d=identicon)[lzqqdy](/maintainers/lzqqdy)

---

Top Contributors

[![lzqqdy](https://avatars.githubusercontent.com/u/41935596?v=4)](https://github.com/lzqqdy "lzqqdy (119 commits)")

---

Tags

composerphptoolstoolslzqqdy

### Embed Badge

![Health badge](/badges/lzqqdy-tools/health.svg)

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

###  Alternatives

[vaimo/composer-patches

Applies a patch from a local or remote file to any package that is part of a given composer project. Patches can be defined both on project and on package level. Optional support for patch versioning, sequencing, custom patch applier configuration and patch command for testing/troubleshooting added patches.

2994.3M16](/packages/vaimo-composer-patches)[dereuromark/cakephp-tools

A CakePHP plugin containing lots of useful and reusable tools

338920.1k32](/packages/dereuromark-cakephp-tools)[longman/ip-tools

PHP IP Tools for manipulation with IPv4 and IPv6

147245.6k6](/packages/longman-ip-tools)[codeigniter4/devkit

Development toolkit for CodeIgniter libraries and projects

68187.1k82](/packages/codeigniter4-devkit)[ramsey/devtools

A Composer plugin to aid PHP library and application development.

7134.7k26](/packages/ramsey-devtools)[glpi-project/tools

Various tools for GLPI and its plugins

12710.9k4](/packages/glpi-project-tools)

PHPackages © 2026

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