PHPackages                             yolaile/library - 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. yolaile/library

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

yolaile/library
===============

yolaile 使用的公共组件包

v0.3.28(1y ago)056MITPHPPHP &gt;=7.3

Since Apr 2Pushed 1y ago1 watchersCompare

[ Source](https://github.com/giles-wong/YoLibrary)[ Packagist](https://packagist.org/packages/yolaile/library)[ RSS](/packages/yolaile-library/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (9)Used By (0)

介绍
==

[](#介绍)

PHP Code Library 收集整理常用的php工具类库

Install
=======

[](#install)

1. 方式一

```
   composer require yolaile/library

```

2. 方式二 Step1: 在项目composer.json文件require段中增加如下：

```
{
    "require": {
        "yolaile/library": "^0.3"
    }
}

```

Step2: 执行 ` composer update yolaile/library`

Document
========

[](#document)

Component
---------

[](#component)

### 1. Log

[](#1-log)

日志组件库，提供日志写入功能

- `(2024-03-20)` Log:[Log, 各项目内日志记录](document/Component/Log.md)

### 2. Signature

[](#2-signature)

api 接口签名验证

- `(2024-04-01)` Signature:[Signature, api 接口签名](document/Component/Signature.md)

### 3. MicroService

[](#3-microservice)

服务间调用包

- `(2024-04-10)` MicroService:[MicroService, 服务调用包](document/Component/MicroService.md)

Support
-------

[](#support)

### 1. File

[](#1-file)

文件上传

- `(2024-04-10)` File:[File, 文件上传](document/Support/File.md)

IdCard.php
----------

[](#idcardphp)

> 用于校验中国大陆居民身份证号码合法性，获取对应的信息，如地区、性别、生日、星座、属相等,身份证代码计算方式为GB 11643-1999标准 , 兼容地区编码变更以前的数据

```
use YoLaile\Library\IdCard;

$idCard = new IdCard();
//验证身份证合法性，合法返回相应的所属信息，不合法返回false
$idcard->verification('210203197503102721');
//随机生成一个身份证号
$idcard->generate();
```

Snowflake.php
-------------

[](#snowflakephp)

> 基于Twitter的雪花算法改造，分布式全局唯一ID生成器, 组成&lt;毫秒级时间戳+机器ip+进程id+序列号&gt;

长度最长为64位bit,各bit位含义如下：

- `1位` 不用。二进制中最高位为1的都是负数，但是我们生成的id一般都使用整数，所以这个最高位固定是0
- `41位` 用来记录时间戳（毫秒）
    - 41位可以表示$2^{41}-1$个数字，
    - 如果只用来表示正整数（计算机中正数包含0），可以表示的数值范围是：0 至 $2^{41}-1$，减1是因为可表示的数值范围是从0开始算的，而不是1。
    - 也就是说41位可以表示$2^{41}-1$个毫秒的值，转化成单位年则是$(2^{41}-1) / (1000 \* 60 \* 60 \* 24 \* 365) = 69$年
- `10位` 机器IP低10位,可以支持最多1023个机器节点
- `10位` 当前处理进程标识,10位的长度最多支持1023个机器进程
- `2位` 计数序列号,序列号即序列自增id,可以支持同一节点的同一进程同一毫秒生成4个ID序号

```
use yolaile\Library\Snowflake;

//生成一个全局唯一ID
echo Snowflake::uniqueId();
```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity31

Early-stage or recently created project

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

Recently: every ~22 days

Total

8

Last Release

680d ago

PHP version history (2 changes)v0.3.17PHP &gt;=7.2

v0.3.23PHP &gt;=7.3

### Community

Maintainers

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

---

Top Contributors

[![giles9028](https://avatars.githubusercontent.com/u/56870153?v=4)](https://github.com/giles9028 "giles9028 (32 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/yolaile-library/health.svg)

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

###  Alternatives

[geo-io/interface

Geo I/O base interfaces.

626.1M7](/packages/geo-io-interface)[psi/news4ward

A blogging / news system for Contao

131.4k13](/packages/psi-news4ward)

PHPackages © 2026

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