diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml index 54748575d..ed57f543a 100644 --- a/.github/workflows/release-build.yml +++ b/.github/workflows/release-build.yml @@ -122,6 +122,15 @@ jobs: mkdir dist/ && cp spc.exe dist/${{ matrix.operating-system.filename }} echo "SUFFIX=.exe" >> $GITHUB_ENV fi + if [ "${{ matrix.operating-system.name }}" = "linux-x86_64" ]; then + cp spc.phar dist/ + fi + + - name: "Upload PHAR to Release" + uses: softprops/action-gh-release@v1 + if: ${{ matrix.operating-system.name == 'linux-x86_64' && startsWith(github.ref, 'refs/tags/') }} + with: + files: dist/spc.phar - name: "Upload Binaries to Release" uses: softprops/action-gh-release@v1 diff --git a/docs/en/guide/installation.md b/docs/en/guide/installation.md index 665679817..dc1751efb 100644 --- a/docs/en/guide/installation.md +++ b/docs/en/guide/installation.md @@ -18,6 +18,7 @@ Pick the installation method that fits your use case: | Method | Best for | |---|---| | Pre-built binary | Most users — download and run, no dependencies | +| PHAR | Users who already have PHP >= 8.4 installed and prefer a single `.phar` file | | From source | Contributors, or anyone who needs to modify core build logic | | Vendor mode | Integrating StaticPHP into an existing PHP project | @@ -51,6 +52,19 @@ On Linux and macOS, mark the binary as executable before running it: chmod +x spc && ./spc --version ``` +## PHAR + +If you already have PHP >= 8.4 installed, you can use the `spc.phar` archive published alongside each release. It requires the `mbstring,posix,pcntl,iconv,phar,zlib` extensions. + +```bash +curl -#fSL https://dl.static-php.dev/v3/spc-bin/nightly/spc.phar -o spc.phar +chmod +x spc.phar && ./spc.phar --version +# or run it through PHP explicitly +php spc.phar --version +``` + +`spc.phar` is also attached to every [GitHub Release](https://github.com/crazywhalecc/static-php-cli/releases). + ## From source This is the right path if you want to contribute to StaticPHP, or need to modify the core registry and build scripts. You'll need PHP >= 8.4, Composer, and the `mbstring,posix,pcntl,iconv,phar,zlib` extensions. diff --git a/docs/zh/guide/installation.md b/docs/zh/guide/installation.md index 3f6abe936..4a43e3bc1 100644 --- a/docs/zh/guide/installation.md +++ b/docs/zh/guide/installation.md @@ -18,6 +18,7 @@ StaticPHP 有多种安装方式,选择适合你的场景: | 方式 | 适合谁 | |---|---| | 预编译二进制 | 大多数用户,直接下载开箱即用 | +| PHAR | 已安装 PHP >= 8.4,偏好单个 `.phar` 文件的用户 | | 从源码安装 | 参与开发、或需要修改核心构建逻辑的开发者 | | Vendor 模式 | 在已有 PHP 项目中集成 StaticPHP 能力 | @@ -51,6 +52,19 @@ curl.exe -#fSL https://dl.static-php.dev/v3/spc-bin/nightly/spc-windows-x86_64.e chmod +x spc && ./spc --version ``` +## PHAR + +如果你已经安装了 PHP >= 8.4,可以直接使用随每个版本一同发布的 `spc.phar`。它需要 `mbstring,posix,pcntl,iconv,phar,zlib` 扩展。 + +```bash +curl -#fSL https://dl.static-php.dev/v3/spc-bin/nightly/spc.phar -o spc.phar +chmod +x spc.phar && ./spc.phar --version +# 也可以显式通过 PHP 运行 +php spc.phar --version +``` + +`spc.phar` 也会作为附件发布到每个 [GitHub Release](https://github.com/crazywhalecc/static-php-cli/releases)。 + ## 从源码安装 适合想参与开发、或需要修改核心注册表和构建脚本的开发者。需要系统已安装 PHP >= 8.4、Composer,以及 `mbstring,posix,pcntl,iconv,phar,zlib` 扩展。