PHPackages                             assad2008/phphelpers - 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. assad2008/phphelpers

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

assad2008/phphelpers
====================

PHP function helpers

1.1.8(3w ago)0345MITPHPPHP ^5.4 || ^7.0 || ^8.0

Since Nov 13Pushed 3w ago1 watchersCompare

[ Source](https://github.com/assad2008/php-functions)[ Packagist](https://packagist.org/packages/assad2008/phphelpers)[ Docs](https://github.com/assad2008/php-functions)[ RSS](/packages/assad2008-phphelpers/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (10)Dependencies (3)Versions (18)Used By (0)

php-functions
=============

[](#php-functions)

PHP自用函数库

函数名称函数描述参数baseUrl获得当前页面根URL$atRoot = FALSE, $atCore = FALSE, $parse = FALSEcutStr截取字符串$string, $length, $dot = '...'countFileLines计算文件行数$filepathciAddslashes深度转义字符串$string, $force = 1ciGmdate格式化时间$timestamp = "", $format = "Y-n-d H:i", $convert = 1debug打印变量$var = null, $type = 2downloadFile下载文件到前端$file, $fileName = ""dayArrList根据时间获得当月所有日期$month, $format = 'Ymd'executeTime求程序运行时间，某些可能无法运行$sec = falsefileGetContents重写file\_get\_cotents$urlgetFileExt得到文件扩展名$fileNamegetOrderId生成订单号，根据日期$type = 'CI', $seqId = 0, $lenth = 18genOrderId根据雪花算法生成订单$datacenterId = 1getJsonData组装json数据$data = \[\], $tip = 'success', $code = 0getRandPro得到概率数组各个值的概率$proArrdfopen请求一个文件$urlgetCharset字符串a-x0-9无getRemoteFileSize远程获取文件大小$urlgetCurrentPageUrl得到当前页面的URL无getDistance根据两点经纬度计算距离$location1, $location2, $unitType = 1, $decimal = 2genRandomStr生成随机字符串$tokenLen = 60getTimeRange计算时间范围$range = 1getRangeTimestamp计算时间戳范围$typegetResponseData组装json数据$data = \[\], $tip = 'success', $code = 0hidePhoneNumber隐藏手机号码中间4位$cellphonejumpURL重定向$uri = '', $method = 'auto', $code = NULLjsonEncodejson encode 去掉转移以及unicode$array = \[\], $numberCheck = 0intToString数字转字符串$numisEmail检测是否是email地址$emailisUtf8检测字符串是否为UTF8编码$stringip获得IP地址无isAllowedIp检查IP是否在白名单之内$ip, array $whitelist = \[\]microtimeFloat返回微秒无rMkdir循环创建文件目录$pathname, $mode = 0777monthArrList得到月份列表$startTimeStamp, $endTimeStampmultiArraySort多维数组排序$multi\_array, $sort\_key, $sort = SORT\_DESC, $sort\_key1 = '', $sort1 = SORT\_DESCoutPutJson输出JSON$data = \[\], $msg = 'success', $code = 0random随机字符串$length, $numeric = 0RC4RC4算法$string, $operation = 'DECODE', $key = 'ci', $expiry = 0rumcmdnowait无需等待执行一条Linux命令$cmdrumcmd执行一条Linux命令$cmdrandomDecimals随机一个浮点数$min, $max, $decimals = 2runSerialize字符串反序列化$str, $array = \[\], $i = 1rarray序列化数组$array, $stringrserialize数组序列化$array = \[\], $ret = '', $i = 1stringToInt字符串转数字$stringscUrlEncode安全的URLENCODE$urlsendLog写一条日志$string, $saveDir = 'sendlog', $t = 'day'safeReplace安全字符串替换$stringurlencode4jsjs encodeURIComponent$stringvalidIpIP地址校验$ipwriteLog写日志内容到文件$fileName, $datawriteFile写文件$filePath, $data

###  Health Score

50

—

FairBetter than 96% of packages

Maintenance95

Actively maintained with recent releases

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity71

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

Recently: every ~334 days

Total

17

Last Release

25d ago

PHP version history (3 changes)1.0PHP ^5.4 || ^7.0

1.0.4PHP ^5.4 || ^7.4

1.1.6PHP ^5.4 || ^7.0 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/a5f312a9eba050739bf5d2892a904e94e903463d9bb1fea94088e7f51a147cc3?d=identicon)[assad2012](/maintainers/assad2012)

---

Top Contributors

[![assad2008](https://avatars.githubusercontent.com/u/2384936?v=4)](https://github.com/assad2008 "assad2008 (23 commits)")

---

Tags

phplibraryfunction

### Embed Badge

![Health badge](/badges/assad2008-phphelpers/health.svg)

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

PHPackages © 2026

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