PHPackages                             luguohuakai/packme - 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. luguohuakai/packme

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

luguohuakai/packme
==================

packing code to tar.gz

v1.0.43(1mo ago)21821[1 issues](https://github.com/luguohuakai/packme/issues)MITPHPPHP &gt;=7.4

Since Aug 26Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/luguohuakai/packme)[ Packagist](https://packagist.org/packages/luguohuakai/packme)[ RSS](/packages/luguohuakai-packme/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (10)Dependencies (4)Versions (45)Used By (0)

PACKME 使用说明
===========

[](#packme-使用说明)

> 序言
>
> 作为研发: 你是否开发完一个功能还在将变更文件一个一个地找出来打包, 然后写一个更新文档, 告诉一线人员该如何替换文件, 升级了哪些功能
>
> 作为一线: 你是否还在一个一个地往服务器上替换研发给你的文件, 有时候文件太多还很容易出错, 做完这些事情之后还没有文档记录, 而一旦出错还要去一个文件一个文件的去恢复
>
> PACKME就是为了解决这些恼人问题, 提升开发愉悦感的小工具, 无论研发还是一线都只需一键执行即可完成打包和部署

> composer require --dev luguohuakai/packme:~1.0.0
>
> 环境依赖: php&gt;=7.4/git/zippy

packme
------

[](#packme)

> 注意: 项目必须使用Git进行管理
> 注意: 项目中尽量不要出现中文路径和文件名, 否则打包时可能会出现问题

请在需要打包的项目根目录执行

- Windows: `.\vendor\bin\packme.bat`
- Linux: `php vendor/bin/packme`

```
Please select packaging method:
      # 全量打包(默认) 可选是否打包vendor目录
      # 全量打包首次运行会在项目根目录下生成dist/version.ini
      # 全量打包时version.ini会自动打包进项目根目录
      [1]: Full packaging
      # 打包最近一次提交和当前未提交的文件
      [2]: Pack the most recently commit and currently not commit files
      # 打包某两次提交的差异文件(需要输入两次提交的commit id 短hash)
      # 注意: 打包差异文件不包括old_commit_id的文件, 包括new_commit_id的文件
      [3]: Pack the difference files commit between two times
      # 打包当前已修改但未提交的文件(注意: 如果当前没有修改的文件会进行全量打包)
      [4]: Pack files that have been modified but not yet commit
      # 打包最近一次提交的文件
      [5]: Pack the most recently commit files
      # 打包最近两次提交的文件
      [6]: Pack the last two commit files
      # 打包指定的一次提交
      [7]: Pack the specified one-time commit
      # 打包指定分支 默认为当前分支 (打包从分支创建到当前最新commit的变更文件)
      [8]: Pack specified branch
      # 打包指定目录(注意:不要出现中文路径或文件名)
      [9]: Pack specified path
 Your choice (default [5]):
```

- 打包产物将生成于`./dist/`目录下
- 注意: 全量打包时, 若选择打包vendor目录将花费较长时间, 请耐心等待
- 同时还可能生成`./dist/version.ini`, 用于记录版本信息
- 大版本更新方式: 只需打包前手动修改`./dist/version.ini`中大版本就行, 如:将V1.0修改为V2.1
- 支持在`./dist/`目录下编写`changes.txt`说明文档, `changes.txt`会被自动打包, 打包时会自动向文档追加提交信息和变更的文件路径
- `./dist/changes.txt`如果没有, 需要自行创建

测试
--

[](#测试)

- 在项目根目录执行: `composer test`
- 当前集成测试会真实创建临时 Git 项目并执行 `packme` / `replaceme` 主流程
- 依赖本机已安装: `composer` `git` `tar` `gzip` `php`

更新迭代计划
------

[](#更新迭代计划)

packme: 打包模式 9 需支持打包绝对路径: 如: D:\\PhpstormProjects\\path\\to\\project 或者 /Users/xx/path/to/project packme: 打包模式 3 如果直接回车不输入 commit id，可以默认取当前分支最新一次提交

### 已知问题

[](#已知问题)

```
1. 文件名存在中文时打包出错,可能是本地环境配置问题
执行以下命令:
git config --global core.quotepath false
git config --global core.assumeunicode true

2. 打包没有文件变更的提交(只有文件删除)时会进行全量打包
修复方案 无文件变更时停止打包

3. 新增文件,然后选择[4]进行打包会报错 如:
Please select packaging method:
      [1]: Full packaging
      [2]: Pack the most recently commit and currently not commit files
      [3]: Pack the difference files commit between two times
      [4]: Pack files that have been modified but not yet commit
      [5]: Pack the most recently commit files
      [6]: Pack the last two commit files
      [7]: Pack the specified one-time commit
      [8]: Pack specified branch
 Your choice (default [5]): 4
Change file exists: ./dist/changes.txt
fatal: pathspec '测试中文文件能否打包和安装.md' did not match any files

```

replaceme
=========

[](#replaceme)

> replaceme.ini配置说明

```
# 要替换的项目在服务器上的绝对路径(自动生成)(可以更改)
object_root = /srun3/www/srun4-mgr/
# 备份文件后缀名(自动生成)(不可更改)
backup_suffix = 20230906011724
# 安装包中需要忽略的目录前缀(按需手动配置)(默认为空)
# 如:
# 安装包中目录为: `ui/assets/img/icon-sprite.svg`
# 服务器中目录为: `/usr/share/zabbix/assets/img/icon-sprite.svg`
# 则需要配置为: 忽略安装包中 `ui/`
ignore_dir_prefix = ui/
```

replaceme
---------

[](#replaceme-1)

### 部署

[](#部署)

- 将安装包直接上传到服务器任意目录
- 解压缩安装包到`任意空目录`, 空目录下不能有任何其它文件
- 如: `tar -zxf xxx.tar.gz -C ./test`
- 进入解压后的目录
- 如: `cd test`
- 执行: `php ./replaceme` (老版本PHP5请执行`php ./replaceme5`, 下面不再赘述)
- 如需记录更新日志则这样执行: `php ./replaceme | tee zzz_exec.log`
- 支持自定义备份后缀: `php ./replaceme --backup=xxx`

```
# 执行过程解释
php ./replaceme
  # 这里需要指定当前项目的根目录, 且项目根目录必须存在, 如果默认目录正确则直接回车
  请指定项目根目录(默认:/srun3/www/xxx/):
```

> 请知悉: 如果被替换的文件存在, 会先备份原来的文件再进行替换, 如果文件不存在, 则会进行自动创建

### 支持回滚操作

[](#支持回滚操作)

- 只能回滚当前安装包内的文件
- 回滚命令: `php ./replaceme --rollback`

###  Health Score

44

—

FairBetter than 91% of packages

Maintenance84

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.6% 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 ~23 days

Recently: every ~127 days

Total

44

Last Release

31d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0f4e6db0dd083b1cc18593e5eb511d7afbd6ac00c0c0caab1ce9f3e82f8e58b8?d=identicon)[luguohuakai](/maintainers/luguohuakai)

---

Top Contributors

[![luguohuakai](https://avatars.githubusercontent.com/u/16839001?v=4)](https://github.com/luguohuakai "luguohuakai (71 commits)")[![dbkuaizi](https://avatars.githubusercontent.com/u/44014601?v=4)](https://github.com/dbkuaizi "dbkuaizi (1 commits)")

---

Tags

packagecompressionarchivetarpackme

### Embed Badge

![Health badge](/badges/luguohuakai-packme/health.svg)

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

###  Alternatives

[composer/composer

Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the right stack everywhere.

29.5k193.1M3.0k](/packages/composer-composer)[jean85/pretty-package-versions

A library to get pretty versions strings of installed dependencies

1.3k306.6M74](/packages/jean85-pretty-package-versions)[alchemy/zippy

Zippy, the archive manager companion

47723.2M52](/packages/alchemy-zippy)[composer/metadata-minifier

Small utility library that handles metadata minification and expansion.

181120.4M21](/packages/composer-metadata-minifier)[wapmorgan/unified-archive

UnifiedArchive - an archive manager with unified interface of working with all popular archive formats (zip/7z/rar/gz/bz2/xz/cab/tar/tar.gz/tar.bz2/tar.x/tar.Z/...) for PHP with ability for listing, reading, extracting and creation + built-in console archive manager.

2791.7M7](/packages/wapmorgan-unified-archive)

PHPackages © 2026

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