PHPackages                             ifreegroup/common-class - 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. ifreegroup/common-class

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

ifreegroup/common-class
=======================

ifreeGroup公共库

1.0.0(6y ago)07PHPPHP &gt;=7.0.0

Since Jul 23Pushed 6y agoCompare

[ Source](https://github.com/shj2013/ifree)[ Packagist](https://packagist.org/packages/ifreegroup/common-class)[ RSS](/packages/ifreegroup-common-class/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

\#当前类库的静态方法有

---

```
命名空间 ifreeGroup
use ifreeGroup/IfreeGroup
> IfreeGroup::json($msg,$code,$data); //用于统一API 的输出格式
> IfreeGroup::createRandomStr(32);//返回随机字符串
> IfreeGroup::emailPattern($email); //邮箱格式是否正确
> IfreeGroup::getIPaddress(); //获取客户端的真实地址
> IfreeGroup::httpRequest($url,$method,$postfields,$headers); //一般以POST 请求为好

```

```
    /**
    *用于统一API 的输出格式
    *@param string $msg  API 输出的描述
    *@param string $code 状态码
    *@param array $data 返回的业务数据
    *@return string 返回json 数据
    */
    use ifreeGroup/IfreeGroup;
    IfreeGroup::json($msg,$code,$data);
    返回的数据参考为
    {
        "msg":"登录成功",
        "code":"2000",
        "data":{
            "user_id":20,
            "account":"12121@qq.com",
            "token":"9a2eb00e19ae1fad7ba130ca80ec6168",
            "user_info":{
                "user_id":20,
                "email":"12121@qq.com",
                "mobile":null,
                "area_code":null,
                "reg_time":"1517820046",
                "nickname":null,
                "first_name":"张",
                "last_name":"大炮",
                "user_token":null,
                "extend":{
                    "sex":1,
                    "birthday":null,
                    "country":null,
                    "avatar":null,
                    "avatar_thumb":null,
                    "device_token":"xxxxx"
                },
                "percent":"42%",
                "open":[
                    {
                        "open_name":"微信",
                        "open_type_id":2,
                        "openid":null
                    },
                    {
                        "open_name":"facebook",
                        "open_type_id":3,
                        "openid":null
                    },
                    {
                        "open_name":"ifree",
                        "open_type_id":4,
                        "openid":null
                    }
                ]
            }
        }
    }

```

```
/**
*随机数生成
*@param string $length 随机机数长度 最大值为52
*@return string 返回随机字符串
*/
使用方法
use ifreeGroup/IfreeGroup;
IfreeGroup::createRandomStr(32);
返回的数据为：64d6960e728b4397f47c13d620f6f78d

```

```
/**
*验证邮件格式是否正确
*@param string $email  邮箱
*@return bool
*/
使用方法：
use ifreeGroup/IfreeGroup;
IfreeGroup::emailPattern('su@ifreegroup.com');
返回的数据为: true;

```

```
/**
*获取客户端的真实地址
*@param 不用传值，直接调用
*@return string 直接返回IP 地址
*/
使用方法：
use ifreeGroup/IfreeGroup;
IfreeGroup::getIPaddress();
返回 IP 地址

```

```
    /**
     * curl 模拟http post/get 请求
     * @param string $url
     * @param string $method
     * @param array $postfields
     * @param array $headers
     * @return mixd
     * @author su@ifreegroup.com
     * @date 2019/7/24  11:18
     */
    use ifreeGroup/IfreeGroup;
    IfreeGroup::httpRequest();

```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity53

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

Unknown

Total

1

Last Release

2488d ago

### Community

Maintainers

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

---

Top Contributors

[![shj2013](https://avatars.githubusercontent.com/u/5556233?v=4)](https://github.com/shj2013 "shj2013 (8 commits)")

### Embed Badge

![Health badge](/badges/ifreegroup-common-class/health.svg)

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

###  Alternatives

[peppeocchi/php-cron-scheduler

PHP Cron Job Scheduler

8282.5M34](/packages/peppeocchi-php-cron-scheduler)[zackkitzmiller/tiny

A reversible base62 ID obfuscater.

401208.4k](/packages/zackkitzmiller-tiny)[klaussilveira/gitter

Gitter allows you to interact in an object oriented manner with Git repositories.

20032.4k5](/packages/klaussilveira-gitter)[lezhnev74/pasvl

Array Validator (regular expressions for nested array, sort of)

5253.7k3](/packages/lezhnev74-pasvl)

PHPackages © 2026

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