PHPackages                             doing/tool - 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. doing/tool

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

doing/tool
==========

常用工具:加密和密码验证,随机字符串,16进制颜色转换,计算距离,数组排序,xml转换数组,curl模拟http请求

0115PHP

Since Mar 29Pushed 8y agoCompare

[ Source](https://github.com/Doing0/tool)[ Packagist](https://packagist.org/packages/doing/tool)[ RSS](/packages/doing-tool/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

> 安装命令：`composer require doing/extp 版本号`如`composer require doing/extp 1.*`

常用工具
====

[](#常用工具)

password使用说明(Tp5)
-----------------

[](#password使用说明tp5)

- 加密

```
use tool\password\Password;
 public function inedx()
    {
        $password = '123456';
        $hash_passworde =  Password::hash($password);
        echo "加密后的密码:".$hash_passworde;
    }//pf

```

- 密码校验

```
 public function verify()
    {
       //原始密码
       $password = '123456';
       //加密后密码
       $hash_passworde = '$2y$12$URUM8UrIhaGpHoQDw34dJ.kjRF9Opv.tK/1Rb9GzFWudHYzfNDFla';
       $res =  Password::verify($password,$hash_passworde);
       print_r($res);
       //如果匹配$res= true 否是=false
    }//pf

```

functions.php常用算法方法
-------------------

[](#functionsphp常用算法方法)

```
1.$randStr = getRandChar($length=32);获取指定长度的随机字符串
2.$newArray = array2DSortByField($array,'number','desc');按number字段倒序
   print_r($newArray);
   array(2) {
     [0] => array(1) {
       ["number"] => int(50)
     }
     [1] => array(1) {
       ["number"] => int(2)
     }
   }
3.$km = getDistanceByCoordinate($myY, $myX, $targetY, $targetX)
  //根据两个经纬度计算出距离(单位KM)
  print_r($km);
4. $RgbArray = hexToRGB("#FF0000");//16进制颜色转换成rgb
    array(3) {
      ["red"] => int(255)
      ["green"] => int(0)
      ["blue"] => int(0)
    }
 5. $array = xmlToArray($xml);将xml格式转换成数组返回
 6. $res = postCurl($url = '',$type = "POST",$data = '', );模拟http请求

```

> 6的参数说明 $url请求地址,$type请求方式GET/POST,$data请求参数,$header请求头 说明:如果$type是GET请求直接把参数拼接在$url上,不传$data

```
7.  $rescult = makeUrlData($url, $dataArray);把数组参数拼接到url上
    $url = "http://www.baidu.com";
    $dataArray['username'] = 'doing';
    $dataArray['action'] = 'send';
    $rescult = "http://www.baidu.com?username=doing&action=send"

```

```
8.根据生日计算年龄:生日必须是阳历的时间戳
//1992-02-28
$birthday = '699240100';
//$age = 26;
$age = clalculateAgeByBirthday($birthday);

```

```
9.给手机号加*
//13838385438
$phone = '13838385438';
$newPhone = wrapPhone($phone);//138****5438

```

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/18565097?v=4)[Doing](/maintainers/Doing)[@doing](https://github.com/doing)

---

Top Contributors

[![Doing0](https://avatars.githubusercontent.com/u/36249980?v=4)](https://github.com/Doing0 "Doing0 (11 commits)")

### Embed Badge

![Health badge](/badges/doing-tool/health.svg)

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

###  Alternatives

[henck/rtf-to-html

RTF to HTML converter in PHP

107837.5k1](/packages/henck-rtf-to-html)

PHPackages © 2026

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