2017 © Pedro Peláez
 

library helper

some helper libaray function

image

anerg2046/helper

some helper libaray function

  • Friday, July 27, 2018
  • by anerg2046
  • Repository
  • 2 Watchers
  • 4 Stars
  • 2,388 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 3 Forks
  • 1 Open issues
  • 10 Versions
  • 17 % Grown

The README.md

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

更新完善中 以下类库都在\\anerg\\helper命名空间下, (*1)

Snowflake

twitter的分布式全局唯一ID生成器PHP实现, (*2)

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

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

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

Http

CURL相关操作, (*3)

// 发起请求,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与Array相关操作, (*4)

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

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

Encrypt

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

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

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

Time

时间相关操作, (*6)

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

The Versions

27/07 2018

dev-master

9999999-dev

some helper libaray function

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

by Coeus

27/07 2018

v1.0.9

1.0.9.0

some helper libaray function

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

by Coeus

18/07 2018

v1.0.8

1.0.8.0

some helper libaray function

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

by Coeus

07/08 2017

1.0.6.2

1.0.6.2

some helper libaray function

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

by Coeus

07/08 2017

1.0.6.1

1.0.6.1

some helper libaray function

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

by Coeus

27/07 2017

1.0.6

1.0.6.0

some helper libaray function

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

by Coeus

27/07 2017

1.0.5

1.0.5.0

some helper libaray function

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

by Coeus

06/02 2017

1.0.4

1.0.4.0

some helper libaray function

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

by Coeus

16/01 2017

1.0.3

1.0.3.0

some helper libaray function

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

by Coeus

05/01 2017

1.0.1

1.0.1.0

some helper libaray function

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

by Coeus