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

ActiveLibrary

hcg/helper
==========

一些常用的php助手函数集合

v0.0.6(4y ago)053MITPHPPHP &gt;=7.0

Since Jan 13Pushed 3y ago1 watchersCompare

[ Source](https://github.com/just5325/helper)[ Packagist](https://packagist.org/packages/hcg/helper)[ RSS](/packages/hcg-helper/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (6)Used By (0)

helper
======

[](#helper)

一些常用的助手函数集合

### 安装

[](#安装)

```
composer require hcg/helper

```

### 拼接图片

[](#拼接图片)

```
// 这是需要拼接的图片数组
$images = ['图片1路径','图片2路径','图片3路径'];
// 这是合成后的图片保存地址
$combine_image = '/tmp/1.png';
// 每张图片的宽高
$width = 200;
$height = 200;
$ci = new CombineImage($images, $combine_image, $width, $height);
$ci->setTransparent(false)->combine();

```

### 常用数组操作

[](#常用数组操作)

#### 将二维数组变成指定key的三维数组

[](#将二维数组变成指定key的三维数组)

```
$arr1 = [
    ['id' => 1, 'type' => 1, 'name' => '黄翠刚'],
    ['id' => 2, 'type' => 1, 'name' => '黄翠刚'],
    ['id' => 3, 'type' => 2, 'name' => '黄翠刚'],
    ['id' => 4, 'type' => 2, 'name' => '黄翠刚'],
    ['id' => 5, 'type' => 2, 'name' => '黄翠刚'],
    ['id' => 6, 'type' => 4, 'name' => '黄翠刚'],
];
$arr2 = HelperArray::buildArrByGroupKey($arr1, 'type');

```

$arr2打印结果：

```
array(3) {
  [1]=>
  array(2) {
    [0]=>
    array(3) {
      ["id"]=>
      int(1)
      ["type"]=>
      int(1)
      ["name"]=>
      string(9) "黄翠刚"
    }
    [1]=>
    array(3) {
      ["id"]=>
      int(2)
      ["type"]=>
      int(1)
      ["name"]=>
      string(9) "黄翠刚"
    }
  }
  [2]=>
  array(3) {
    [0]=>
    array(3) {
      ["id"]=>
      int(3)
      ["type"]=>
      int(2)
      ["name"]=>
      string(9) "黄翠刚"
    }
    [1]=>
    array(3) {
      ["id"]=>
      int(4)
      ["type"]=>
      int(2)
      ["name"]=>
      string(9) "黄翠刚"
    }
    [2]=>
    array(3) {
      ["id"]=>
      int(5)
      ["type"]=>
      int(2)
      ["name"]=>
      string(9) "黄翠刚"
    }
  }
  [4]=>
  array(1) {
    [0]=>
    array(3) {
      ["id"]=>
      int(6)
      ["type"]=>
      int(4)
      ["name"]=>
      string(9) "黄翠刚"
    }
  }
}

```

#### 将二维数组变成指定key

[](#将二维数组变成指定key)

```
$arr3 = HelperArray::buildArrByNewKey($arr1, 'id');

```

$arr3打印结果：

```
array(6) {
  [1]=>
  array(3) {
    ["id"]=>
    int(1)
    ["type"]=>
    int(1)
    ["name"]=>
    string(9) "黄翠刚"
  }
  [2]=>
  array(3) {
    ["id"]=>
    int(2)
    ["type"]=>
    int(1)
    ["name"]=>
    string(9) "黄翠刚"
  }
  [3]=>
  array(3) {
    ["id"]=>
    int(3)
    ["type"]=>
    int(2)
    ["name"]=>
    string(9) "黄翠刚"
  }
  [4]=>
  array(3) {
    ["id"]=>
    int(4)
    ["type"]=>
    int(2)
    ["name"]=>
    string(9) "黄翠刚"
  }
  [5]=>
  array(3) {
    ["id"]=>
    int(5)
    ["type"]=>
    int(2)
    ["name"]=>
    string(9) "黄翠刚"
  }
  [6]=>
  array(3) {
    ["id"]=>
    int(6)
    ["type"]=>
    int(4)
    ["name"]=>
    string(9) "黄翠刚"
  }
}

```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity38

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

Total

5

Last Release

1581d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/383f2f33430cfe8c055049f97cf3b095eae355b85c08e5c4c2db73665091cb34?d=identicon)[hcg](/maintainers/hcg)

---

Top Contributors

[![just5325](https://avatars.githubusercontent.com/u/26363339?v=4)](https://github.com/just5325 "just5325 (13 commits)")

### Embed Badge

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

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

PHPackages © 2026

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