PHPackages                             lampliu/helper - 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. lampliu/helper

ActiveLibrary

lampliu/helper
==============

some helper libaray function

01PHP

Since Aug 3Pushed 6y ago1 watchersCompare

[ Source](https://github.com/lampliu/helper)[ Packagist](https://packagist.org/packages/lampliu/helper)[ RSS](/packages/lampliu-helper/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

我自己常用的一些扩展类库
============

[](#我自己常用的一些扩展类库)

> 更新完善中 以下类库都在`\\anerg\\helper`命名空间下

Snowflake
---------

[](#snowflake)

> twitter的分布式全局唯一ID生成器PHP实现

```
//两个方法均可携带2个参数，第一个是机器编号，如果为0，则生成的id会忽略机器标识段
//第二个是数组，可用键值epoch，maxMachineBit，maxRandomBit
//具体请查询代码

// 获取一个10进制的唯一ID
Snowflake::nextId(1)

// 获取一个36进制的唯一ID
Snowflake::nextHash(1)

```

Http
----

[](#http)

> CURL相关操作

```
// 发起请求,get/post
Http::request($url, $data = null, $method = 'get', $params = null)

// get方式请求
Http::get($url, $data = null, $params = null)

// post方式请求
Http::post($url, $data = null, $params = null)

// post方式发送原始数据
Http::postRaw($url, $raw, $params = null)

// 带ssl证书请求原始数据
// $params数组必须包含cert_path,key_path,ca_path三个证书地址
Http::postRawSsl($url, $raw, $params)

//下载图片到指定位置
Http::saveImage($url, $path, $filename = null, $params = null)

```

Xml
---

[](#xml)

> XML与Array相关操作

```
// xml转为数组
Xml::xmlToArr($xml)

// 数组转为xml
Xml::arrToXml($array)

```

Encrypt
-------

[](#encrypt)

> 可逆加解密类,默认仅支持TP5,如果要支持其他,请修改getKey方法

```
// 加密字符串/数组
Encrypt::encrypt($data, $expire = 0, $key = '')

// 解密字符串
Encrypt::decrypt($data, $key = '')

```

Time
----

[](#time)

> 时间相关操作

```
// 输出优化后的时间显示格式
Time::pretty($time)

```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity36

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/3d21d5e8f4eb9f55e38bb30e5dee3996f2136116e875408da7369f836d49a288?d=identicon)[lampliu](/maintainers/lampliu)

---

Top Contributors

[![lampliu](https://avatars.githubusercontent.com/u/21076610?v=4)](https://github.com/lampliu "lampliu (2 commits)")

### Embed Badge

![Health badge](/badges/lampliu-helper/health.svg)

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

PHPackages © 2026

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