mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-12 03:15:35 +08:00
Update CLI documentation for clarity and accuracy
This commit is contained in:
@@ -516,10 +516,3 @@ spc spc-config "bcmath,openssl" --libs
|
|||||||
# Use absolute library paths
|
# Use absolute library paths
|
||||||
spc spc-config "bcmath,openssl" --libs --absolute-libs
|
spc spc-config "bcmath,openssl" --libs --absolute-libs
|
||||||
```
|
```
|
||||||
Enter an interactive shell with StaticPHP's build environment pre-loaded (compiler wrappers, `buildroot/`, `pkgroot/` paths, etc. on `PATH`).
|
|
||||||
|
|
||||||
```bash
|
|
||||||
spc dev:shell
|
|
||||||
```
|
|
||||||
|
|
||||||
Useful for compiling small programs against `libphp.a` (embed SAPI) or inspecting the build environment manually.
|
|
||||||
|
|||||||
@@ -74,6 +74,10 @@ This approach lets you run download and compile as separate steps — useful whe
|
|||||||
|
|
||||||
### Step 1: Download Dependencies
|
### Step 1: Download Dependencies
|
||||||
|
|
||||||
|
In v3, you can skip this step entirely — running `build:php` directly will automatically download any missing artifacts.
|
||||||
|
|
||||||
|
If you want to pre-download ahead of time, or if you're working in a slow-network environment and want to separate the download phase, use the `download` command:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Download only what the chosen extensions need (recommended)
|
# Download only what the chosen extensions need (recommended)
|
||||||
spc download --for-extensions="bcmath,posix,phar,zlib,openssl,curl,fileinfo,tokenizer" --with-php=8.4
|
spc download --for-extensions="bcmath,posix,phar,zlib,openssl,curl,fileinfo,tokenizer" --with-php=8.4
|
||||||
|
|||||||
@@ -82,13 +82,6 @@ The script downloads `php` and `composer` into a `runtime/` subdirectory. You th
|
|||||||
# Add this to ~/.bashrc or ~/.zshrc to make it permanent
|
# Add this to ~/.bashrc or ~/.zshrc to make it permanent
|
||||||
```
|
```
|
||||||
|
|
||||||
::: tip
|
|
||||||
In regions with restricted access to GitHub or getcomposer.org, pass `--mirror china` to use a mirror:
|
|
||||||
```bash
|
|
||||||
bin/setup-runtime --mirror china
|
|
||||||
```
|
|
||||||
:::
|
|
||||||
|
|
||||||
## Vendor mode
|
## Vendor mode
|
||||||
|
|
||||||
If you already have a PHP project and want to call StaticPHP's build APIs directly, or use a custom registry to support private libraries and extensions, pull it in as a Composer dependency:
|
If you already have a PHP project and want to call StaticPHP's build APIs directly, or use a custom registry to support private libraries and extensions, pull it in as a Composer dependency:
|
||||||
|
|||||||
@@ -405,9 +405,6 @@ spc install-pkg <package> [options]
|
|||||||
```bash
|
```bash
|
||||||
# 安装 UPX 压缩工具
|
# 安装 UPX 压缩工具
|
||||||
spc install-pkg upx
|
spc install-pkg upx
|
||||||
|
|
||||||
# 安装时优先使用预编译二进制(默认行为)
|
|
||||||
spc install-pkg upx
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## micro:combine
|
## micro:combine
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ aside: false
|
|||||||
|
|
||||||
- **必需依赖**:构建该包时会强制一同构建的包。
|
- **必需依赖**:构建该包时会强制一同构建的包。
|
||||||
- **可选依赖**:默认不构建,使用 `--with-suggests` 参数可启用,或在构建命令中手动指定。
|
- **可选依赖**:默认不构建,使用 `--with-suggests` 参数可启用,或在构建命令中手动指定。
|
||||||
- **被依赖**:其他哪些包需要当前包。
|
- **被依赖 / 被建议**:其他哪些包将当前包作为必需或可选依赖。
|
||||||
|
|
||||||
运行以下命令生成依赖数据(需要在源码模式下):
|
运行以下命令生成依赖数据(需要在源码模式下):
|
||||||
|
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ bin/spc build gd --with-libs=freetype,libjpeg,libavif,libwebp --build-cli
|
|||||||
|
|
||||||
## xml
|
## xml
|
||||||
|
|
||||||
1. xml 包括 xmlreader、xmlwriter、dom、simplexml 等,添加 xml 扩展时最好同时启用这些扩展。
|
1. xml 包括 xmlreader、xmlwriter、xsl、dom、simplexml 等,添加 xml 扩展时最好同时启用这些扩展。
|
||||||
2. libxml 包含在 xml 扩展中。启用 xml 相当于启用 libxml。
|
2. libxml 包含在 xml 扩展中。启用 xml 相当于启用 libxml。
|
||||||
|
|
||||||
## glfw
|
## glfw
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ chmod +x spc && ./spc --version
|
|||||||
适合想参与开发、或需要修改核心注册表和构建脚本的开发者。需要系统已安装 PHP >= 8.4、Composer,以及 `mbstring,posix,pcntl,iconv,phar,zlib` 扩展。
|
适合想参与开发、或需要修改核心注册表和构建脚本的开发者。需要系统已安装 PHP >= 8.4、Composer,以及 `mbstring,posix,pcntl,iconv,phar,zlib` 扩展。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/static-php/static-php.git --branch v3
|
git clone https://github.com/crazywhalecc/static-php-cli.git --branch v3
|
||||||
cd static-php-cli
|
cd static-php-cli
|
||||||
composer install
|
composer install
|
||||||
```
|
```
|
||||||
@@ -100,9 +100,15 @@ Vendor 模式的详细用法见 [扩展 StaticPHP](../develop/extending/)。
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 使用 spc 二进制
|
# 使用 spc 二进制
|
||||||
./spc doctor --auto-fix
|
./spc doctor
|
||||||
# 使用源码安装
|
# 使用源码安装
|
||||||
bin/spc doctor --auto-fix
|
bin/spc doctor
|
||||||
|
```
|
||||||
|
|
||||||
|
如有缺失,`--auto-fix` 会尝试自动安装修复:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./spc doctor --auto-fix
|
||||||
```
|
```
|
||||||
|
|
||||||
检查通过后,继续阅读[第一次构建](./first-build)。
|
检查通过后,继续阅读[第一次构建](./first-build)。
|
||||||
|
|||||||
Reference in New Issue
Block a user