PHPackages                             songyz/common-lib - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. songyz/common-lib

ActiveLibrary[Testing &amp; Quality](/categories/testing)

songyz/common-lib
=================

公用工具包

v2.1.0(4y ago)33.1k1MITPHPPHP &gt;=7.1

Since May 21Pushed 4y ago1 watchersCompare

[ Source](https://github.com/songyongzhan/common-lib)[ Packagist](https://packagist.org/packages/songyz/common-lib)[ RSS](/packages/songyz-common-lib/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (17)Used By (1)

common-lib
==========

[](#common-lib)

工具、资源、公共库

Aes加解密
------

[](#aes加解密)

### 加密

[](#加密)

```
    $str = 'james';
    $str = Aes::encrypt($str, '123');
    echo $str;
```

### 解密

[](#解密)

```
    $str = 'NL7rrUNodNkSMvdBtDbob334VRnlM25/TPjkCcga9mE=';
    $data = Aes::decrypt($str, '123');
    var_dump($data);
```

验证码-api base64
--------------

[](#验证码-api-base64)

```
$img = Captcha::createImg("1234");
print_r($img);
```

参数讲解

- @param string $code 验证码 选
- @param int $width 图片宽度 选 默认 70
- @param int $height 图片高度 选 默认 25
- @param int $len 验证码长度 选 默认4 如果你传递的code是5位，这里就写5
- @param bool $border 图片是否有边框 选
- @param string $fontPath 验证码文字路径 选

身份证验证
-----

[](#身份证验证)

### 返回年龄、生日、性别 相关的信息

[](#返回年龄生日性别-相关的信息)

```
 $idCardInfo = Card::idCardInfo("130182198411201911");
```

### 根据身份证获取生日

[](#根据身份证获取生日)

```
$birthDay = Card::getBirthDay("130182198411201911", "/");
```

Rsa 非对称加密
---------

[](#rsa-非对称加密)

请参考 `tests/RsaTest.php`

Jwt jsonToken使用
---------------

[](#jwt-jsontoken使用)

### jwt token 数据加密

[](#jwt-token-数据加密)

```
    $token = '';
    $jwtService = new JwtService($token, $this->jwt_rsa_public, $this->jwt_rsa_private, $this->jwt_expire);
    $token = $jwtService->getToken(1, ['name' => 'james']);
    echo $token;
```

其他功能请参考 `tests/JwtTest.php`

Tree 递归、分类
----------

[](#tree-递归分类)

请参考 `tests/TreeTest.php`

Tools 工具类
---------

[](#tools-工具类)

###  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

Maturity59

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

Recently: every ~21 days

Total

16

Last Release

1491d ago

Major Versions

v1.0.13 → v2.0.12022-04-13

### Community

Maintainers

![](https://www.gravatar.com/avatar/1be607dcd56d91f02546e5f4df0e45b5c0c4bb3fcf2af6fa9ea6b20a65eb4a17?d=identicon)[songyongzhan](/maintainers/songyongzhan)

---

Top Contributors

[![songyongzhan](https://avatars.githubusercontent.com/u/11246367?v=4)](https://github.com/songyongzhan "songyongzhan (15 commits)")

---

Tags

requestapitestlaravelgeneratorormcrud

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/songyz-common-lib/health.svg)

```
[![Health](https://phpackages.com/badges/songyz-common-lib/health.svg)](https://phpackages.com/packages/songyz-common-lib)
```

PHPackages © 2026

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