PHPackages                             gdpeter/tp6-addons - 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. gdpeter/tp6-addons

ActiveLibrary

gdpeter/tp6-addons
==================

1.0.1(2y ago)15MITPHPPHP &gt;= 7.1.0

Since Jun 1Pushed 2y ago1 watchersCompare

[ Source](https://github.com/593349399/tp6-addons)[ Packagist](https://packagist.org/packages/gdpeter/tp6-addons)[ RSS](/packages/gdpeter-tp6-addons/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (5)Versions (3)Used By (0)

### 基于THINKPHP6的版本控制拓展

[](#基于thinkphp6的版本控制拓展)

特点：

1. 使用git进行版本管理，`php think package:build 1.0.0 1.0.1` 即可生成1.0.1版本的增量补丁
2. 主要的一个函数是`installPackage('system','1.0.1','补丁地址','补丁MD5')`，从下载到安装一条龙
    1. 使用文件锁保证多进程并发情况下只会执行一次
    2. 使用md5和配置的检查对包的完整性进行了验证
    3. 支持包的断点下载，保证网络不好的时候下载补丁失败
    4. 动态配置每次更新的执行文件/SQL文件
    5. 动态配置不同包的event、command
    6. 完整的执行日志
    7. ......

升级示例：

> 示例仅为系统补丁升级流程！！！安装流程、插件流程劳驾您举一反三

> git、tp6得熟悉，示例干得啥理解了就行，别原搬示例代码

> 示例分支：master、1.0.0、1.0.1，注意分支一定要push到origin，git diff的时候自动加了origin的前缀

1. `git checkout master` 切换至主分支
2. 安装拓展 `composer require gdpeter/tp6-addons`
3. 配置config/package.php

```
return [
    'type'=>[ //这个是分组，package.xml配置里面可以配置type
        'system'=>[ //系统包
            'dep'=>0, //深度 0表示这个目录就是一个项目
            'path'=> root_path()
        ],
//        'addons'=>[ //插件包
//            'dep'=>1, // 1表示这个目录里面有多个项目
//            'path'=> root_path() . 'addons/'
//        ],
        'debug'=>env('app.debug', false), //debug模式不开启缓存
        'burst'=>4048*1024, //补丁下载分包大小
        'sql_from_pre' => 'tp6_', //数据库替换前缀
        //...详细配置请查看Gdpeter\Tp6Addons\Service服务注入的$defaultConfig
    ],
]
```

4. 配置1.0.0版本的 package.xml到包的目录，这里system包是在根目录

```

```

5. 自行新建 安装.sql，也可以改成 安装.php也会执行,或者不创建
6. `git checkout -b 1.0.0 master` 切换至1.0.0分支并推送，此时1.0.0版本已经生成，包是完整的1.0.0zip，可用于安装（不演示）
7. 切换至master分支，同上配置1.0.1版本的 package.xml，新建分支1.0.1，推送到git origin

```

```

8. 此时git origin 有三个分支，master、1.0.0、1.0.1，使用命令生成1.0.1补丁`php think package:build 1.0.0 1.0.1`，查看1.0.1版本是否生成：package\_build/1.0.1.zip
9. 任意处理1.0.1.zip到cdn或者某个可以下载的地方即可，获取其md5\_file值，此时有url和md5了

在某段升级代码中是这样运行的，首先它是1.0.0版本了，然后执行1.0.1的更新

```
//注意这里的system是包名identifie不是分组type，例如你是dep为1的type为addons中有一个插件名为coupon，这里是coupon而非addons
$res = app(Package::class)->installPackage('system','1.0.1','http://xxx/1.0.1.zip','md5xxxxxxx');

if($res){
    $this->success('升级成功');
}else{
    $this->error('升级进程正在进行中！');
}
```

> 就是这么简单就升级成功了！！！！

> app('package') 可以获取service服务，具体看代码Gdpeter\\Tp6Addons\\Service

> app(Package::class) 可以获取安装服务，具体看代码Gdpeter\\Tp6Addons\\library\\Package

以下展示补丁生成，只需要执行`php think package:build 1.0.0 1.0.1`即可得到1.0.1版本的补丁了 [![img.png](img.png)](img.png)[![img_1.png](img_1.png)](img_1.png)

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

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

Every ~1 days

Total

2

Last Release

1073d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

addonsgitdiffthinkphp6

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/gdpeter-tp6-addons/health.svg)

```
[![Health](https://phpackages.com/badges/gdpeter-tp6-addons/health.svg)](https://phpackages.com/packages/gdpeter-tp6-addons)
```

###  Alternatives

[topthink/think

the new thinkphp framework

8.0k1.2M13](/packages/topthink-think)[topthink/think-queue

The ThinkPHP6 Queue Package

640675.0k75](/packages/topthink-think-queue)[topthink/think-swoole

Swoole extend for thinkphp

477174.4k19](/packages/topthink-think-swoole)[topthink/think-captcha

captcha package for thinkphp

132934.4k68](/packages/topthink-think-captcha)[topthink/think-worker

workerman extend for thinkphp

202227.2k9](/packages/topthink-think-worker)[topthink/think-migration

96460.8k121](/packages/topthink-think-migration)

PHPackages © 2026

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