PHPackages                             hashyoo/damon-function - 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. hashyoo/damon-function

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

hashyoo/damon-function
======================

封装一些常用的函数，仅限php使用

v1.1.2(5y ago)0692MITPHPPHP &gt;=5.6.0

Since Jul 8Pushed 5y ago1 watchersCompare

[ Source](https://github.com/hashyoo/damon-function)[ Packagist](https://packagist.org/packages/hashyoo/damon-function)[ RSS](/packages/hashyoo-damon-function/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (13)Used By (2)

damon-function 常用函数
===================

[](#damon-function-常用函数)

概述
--

[](#概述)

> 整个函数库包含3个文件，分别为helper.php、helper-data-type.php、helper-date.php

> helper.php主要存放常用函数 helper-data-type.php主要存放数据类型相关处理函数 helper-date.php主要存放日期相关处理函数

环境变量 env
--------

[](#环境变量-env)

> 若项目中没有加载.env文件功能，可使用yoo\_load\_ini\_file()加载文件，然后使用env()获取

helper.php
----------

[](#helperphp)

函数名作用yoo\_dump打印数据yoo\_debug打印数据yoo\_http\_host当前访问链接网址域名yoo\_client\_ip客户端IP地址yoo\_read\_ini\_file读取配置文件yoo\_load\_ini\_file加载配置文件env获取环境配置变量yoo\_msg\_error错误消息yoo\_echo\_error错误提示yoo\_hello\_error友好返回错误信息yoo\_hello\_fail友好返回失败信息yoo\_hello\_success友好返回成功信息yoo\_preg\_password密码正则验证字符yoo\_preg\_phone手机号正则验证字符yoo\_password\_judge\_safety判断密码安全级别yoo\_password\_judge\_score密码安全评分yoo\_plate\_no\_city根据车牌号识别省市信息yoo\_xml\_to\_arrayxml转数组yoo\_param\_str数组形式的链接参数转换成字符串形式yoo\_curl\_getcurl get提交数据发送请求yoo\_curl\_postcurl post提交数据发送请求yoo\_curl\_download远程文件下载yoo\_api\_gaode\_geocode高德地图-地理编码-地址转经纬度yoo\_location\_distance计算两个经纬度之间的距离helper-data-type.php
--------------------

[](#helper-data-typephp)

函数名作用yoo\_string\_pad字符串补位yoo\_number\_pad数字补位yoo\_number\_format数字格式化yoo\_string\_trim过滤字符串yoo\_hide\_string隐藏字符串中的部分字符串yoo\_random\_articl\_says从文章里随机抽取一句话yoo\_pad\_url补充链接地址yoo\_take\_img从html中提取图片地址(使用正则)yoo\_random\_order\_sn随机生成唯一订单号yoo\_unique\_token生成唯一tokenyoo\_upper\_base64\_md5字符串转换成大写 base64 md5yoo\_make\_tree一维数组生成树状数组yoo\_tree\_child\_ids递归获取所有子级的数据idyoo\_tree\_ico树形前缀icoyoo\_tree\_list树形数组转换成一维伪树形数组yoo\_array\_remain保留数组内指定key值的几个元素yoo\_array\_remove去除数组内指定key值的几个元素yoo\_array\_del\_null删除数组中值为null的字段yoo\_array\_trim过滤数组value值里的空格yoo\_string\_underline\_to\_hump字符串命名风格转换 【下划线转驼峰】yoo\_array\_underline\_to\_hump数组元素字符串命名风格转换 【下划线转驼峰】yoo\_array\_kvs列表数组转换成键值对的一维关联数组yoo\_str\_idsid集合数组转为标识分隔的字符串yoo\_array\_idsid标识分隔的字符串转为id集合数组yoo\_array\_vpad一维数组每个value值加上特定的字符yoo\_array\_vreplace一维数组每个value值公共的字符替换成其他的字符yoo\_array\_dikaer处理数组变成笛卡尔积yoo\_array\_cartesian处理数组变成笛卡尔积-多参数helper-date.php
---------------

[](#helper-datephp)

函数名作用yoo\_seconds\_to\_daytime秒数转成天 小时 分钟yoo\_friendly\_date友好的时间显示yoo\_ymdhis时间戳 转换成 年月日时分秒yoo\_timestring\_to\_ymdhis字符时间日期转为日期格式yoo\_month\_days指定时间戳月份天数yoo\_month\_start\_day指定时间戳月份第一天yoo\_month\_end\_day指定时间戳月份最后一天yoo\_month\_start指定时间戳月份第一天 精确到秒yoo\_month\_end指定时间戳月份最后一天 精确到秒yoo\_range\_format\_date获取指定日期段内指定格式日期的集合yoo\_mysql\_date\_format日期格式-mysql语句yoo\_nearly\_date获取最近的日期 一周 一月 半年

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity57

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

Recently: every ~18 days

Total

12

Last Release

2044d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1426f942d621addf279b853aca762f7321c8b66b2ce7f532b78adfd225224b31?d=identicon)[wu](/maintainers/wu)

---

Top Contributors

[![Simooonn](https://avatars.githubusercontent.com/u/24266163?v=4)](https://github.com/Simooonn "Simooonn (20 commits)")

---

Tags

phplaravelfunction

### Embed Badge

![Health badge](/badges/hashyoo-damon-function/health.svg)

```
[![Health](https://phpackages.com/badges/hashyoo-damon-function/health.svg)](https://phpackages.com/packages/hashyoo-damon-function)
```

###  Alternatives

[laravelista/ekko

Framework agnostic PHP package for marking navigation items active.

278673.4k4](/packages/laravelista-ekko)[amranidev/laracombee

Recommendation system for laravel

11636.7k1](/packages/amranidev-laracombee)[wujunze/money-wrapper

MoneyPHP Wrapper

113.8k](/packages/wujunze-money-wrapper)

PHPackages © 2026

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