承接 coolstudio/nyx-protobuf 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

coolstudio/nyx-protobuf

Composer 安装命令:

composer require coolstudio/nyx-protobuf

包简介

Generated PHP bindings for the Nyx backup platform Protocol Buffers contract (backup.v1). Source of truth lives in the protobuf submodule.

README 文档

README

Generated PHP bindings for the Nyx backup platform Protocol Buffers contract (backup.v1). The .proto source of truth is not copied here — it is pulled in as a git submodule from the upstream CS-Nyx2/protobuf module, and the PHP classes in src/ are generated from it.

This package exists so the Laravel API (and any other PHP consumer) can depend on the contract via Composer / Packagist instead of vendoring protoc output by hand.

Layout

protobuf-php/
├── protobuf/                 # git submodule -> CS-Nyx2/protobuf (the .proto contract)
├── src/                      # generated PHP (committed; PSR-4 root "CoolStudio\")
│   └── CoolStudio/Nyx/V1/... #   message + enum classes (CoolStudio\Nyx\V1\…)
│       └── Meta/...          #   descriptor metadata (CoolStudio\Nyx\V1\Meta\…)
├── buf.gen.yaml              # PHP-only codegen template (out: ./src)
├── scripts/generate.sh       # regenerate src/ (buf if present, else protoc)
├── Makefile                  # make generate / make check / make submodule
├── composer.json             # Packagist manifest (PSR-4 autoload)
└── .github/workflows/        # ci.yml + sync-protobuf.yml + tag-release.yml

The generated code is committed on purpose: Packagist installs straight from a git tag with no build step, so consumers must receive ready-to-autoload PHP.

How releases happen (automated)

You normally never touch this repo by hand. Contract changes flow through to a published Composer version end-to-end:

  1. Upstream proto change. CS-Nyx2/protobuf validates a .proto change (buf lint/build/breaking) and, on success, sends a repository_dispatch (protobuf-updated) here.
  2. Regeneratesync-protobuf.yml pins the submodule to that validated commit, runs make generate, and commits the regenerated src/ (plus the bumped submodule pointer) straight to main.
  3. Validateci.yml runs on the new main commit: composer validate --strict, a generated-code drift check, a PHP lint, and an autoload smoke test.
  4. Tag — when CI succeeds, tag-release.yml fires (via workflow_run). If any *.php or composer.json changed since the last vX.Y.Z tag, it patch-bumps and pushes a new tag. Doc-only or CI-only pushes don't cut a release.
  5. Publish — Packagist's own GitHub webhook sees the new tag and refreshes the package. Nothing in this repo pings the Packagist API; pushing the tag is the release.

So a validated upstream proto change becomes a new Composer version with no human in the loop. The manual steps below are escape hatches: local iteration, and cutting a minor/major version (the automation only ever patch-bumps).

Using the library (consumers)

composer require coolstudio/nyx-protobuf
use CoolStudio\Nyx\V1\BackupTask;
use CoolStudio\Nyx\V1\TaskStatus;

$task = new BackupTask();
$task->setStatus(TaskStatus::TASK_STATUS_PENDING);

The only runtime dependency is the official google/protobuf library. For better performance you may optionally install the native protobuf PECL extension; it is not required.

Regenerating the bindings by hand (maintainers)

In normal operation sync-protobuf.yml does this for you (see above). Do it locally only to iterate on the codegen template, debug drift, or recover if the automation is wedged. You can also trigger the same job from the GitHub Actions tab via Run workflow (Sync protobuf), optionally passing a specific proto commit SHA.

Prerequisites: protoc (or buf). PHP support is built into protoc, so no extra plugin is needed.

git submodule update --init --recursive   # or: make submodule
make generate                             # rewrites src/ from protobuf/proto

To advance to a newer version of the contract, move the submodule pointer and regenerate:

git -C protobuf pull origin main
make generate
git add protobuf src
git commit -m "chore: regenerate against protobuf <sha>"

CI (.github/workflows/ci.yml) runs scripts/generate.sh --check, which regenerates into a temp dir and fails the build if src/ has drifted from the proto contract — so a stale checkout can never be released. Once this commit lands on main, the tag-release automation publishes it like any other change.

Publishing to Packagist

The repository is already Packagist-ready; the prerequisites that live here are:

  • a valid composer.json (composer validate --strict passes in CI),
  • an OSI LICENSE,
  • PSR-4 autoloading with the generated code committed under src/,
  • SemVer git tags as the version source,
  • tag-release.yml to cut those tags automatically once CI is green.

Packagist refreshes itself from its own GitHub webhook on every tag push, so — unlike the original design — nothing in this repo calls the Packagist API. There is no release.yml and no PACKAGIST_* secret.

One-time setup:

  1. Push this folder to its own GitHub repo: https://github.com/CS-Nyx2/protobuf-php.
  2. On packagist.org, Submit that repository URL.
  3. Enable the GitHub service hook (Packagist shows the exact steps) so each tag push auto-updates the package. This webhook is the only link to Packagist — the tag-release workflow just pushes the tag and the hook does the rest.
  4. Add the SUBMODULE_TOKEN secret (below).

Required CI secret

The protobuf submodule lives in the private CS-Nyx2/protobuf repo, so the workflows can't fetch it with the default GITHUB_TOKEN. Add one repository secret (Settings → Secrets and variables → Actions):

Secret Used by What it is
SUBMODULE_TOKEN ci.yml, sync-protobuf.yml PAT with read access to CS-Nyx2/protobuf and write access to this repo. ci.yml uses it to fetch the private submodule; sync-protobuf.yml additionally uses it to push the regenerated bindings back to main. Fine-grained PAT (Contents: read on protobuf, read+write on protobuf-php), classic PAT with repo scope, or a GitHub App installation token.

tag-release.yml needs no secret — it tags with the built-in GITHUB_TOKEN (permissions: contents: write) and never touches the submodule. (If CS-Nyx2/protobuf is later made public, drop SUBMODULE_TOKEN and the token: lines, though sync-protobuf.yml still needs write to push.)

Cutting a release manually

You rarely need to — a release tag is pushed automatically whenever CI passes on main with PHP/composer changes. Reach for a manual tag only to bump the minor or major version (the automation always patch-bumps the highest existing tag):

git tag v1.0.0
git push origin v1.0.0     # Packagist's GitHub hook picks it up

The next automated release then continues patch-bumping from v1.0.0. Packagist exposes the tag for composer require within moments of the push.

Note: the package is published as coolstudio/nyx-protobuf (Packagist vendor coolstudio) by CoolStudio (https://cool.studio) under an MIT license. The GitHub URLs above still point at the CS-Nyx2 org that hosts the repos.

coolstudio/nyx-protobuf 适用场景与选型建议

coolstudio/nyx-protobuf 是一款 基于 Shell 开发的 Composer 扩展包,目前已累计 9 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 06 月 10 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「backup」 「laravel」 「generated」 「protobuf」 「nyx」 「gRPC」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 coolstudio/nyx-protobuf 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 coolstudio/nyx-protobuf 我们能提供哪些服务?
定制开发 / 二次开发

基于 coolstudio/nyx-protobuf 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 9
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 43
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: Shell

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-10