Refactor documentation structure and add new artifact model guide

This commit is contained in:
crazywhalecc
2026-04-29 14:28:17 +08:00
parent 3c4f39735e
commit 269cd600f8
23 changed files with 530 additions and 79 deletions

View File

@@ -0,0 +1,6 @@
# 注解参考
<!-- TODO: 所有 v3 PHP 注解的完整参考。
#[Library]、#[Extension]、#[BuildFor]、#[BeforeStage]、#[AfterStage]、
#[PatchBeforeBuild]、#[CustomPhpConfigureArg]、#[AsCheckItem]、#[AsFixItem]。
每个注解:参数、类型、允许的 target、示例。 -->

View File

@@ -0,0 +1,8 @@
# 自定义 Artifact
<!-- TODO: 介绍如何在 src/Package/Artifact/ 下实现自定义下载类。
说明 type: custom 的适用场景(如需鉴权、非标准压缩包格式等)。
涵盖:类的位置与命名规范、方法签名(默认下载方法与 func 分发)、
读取配置字段、返回解压后的源码路径、
通过 spc.registry.yml 的 artifact psr-4 映射注册类。
提供带注释的完整代码示例。 -->

View File

@@ -0,0 +1,5 @@
# 依赖注入
<!-- TODO: v3 中 PHP-DI 自动装配的工作方式。
ApplicationContext::get() 用法。注册自定义服务。
向命令类、构建类和阶段方法注入依赖。 -->

View File

@@ -0,0 +1,8 @@
# 扩展 StaticPHP
<!-- TODO: 介绍三种扩展方式:
1. 贡献到 core —— 直接修改 src/Package/ 和 config/pkg/。
2. 外部 Registry —— 通过 SPC_REGISTRIES 环境变量指向自定义 spc.registry.yml。
3. Vendor 模式 —— 将类和配置打包为 Composer 库composer require
说明各方式的适用场景。给出最小端到端示例:
一个 Library 类 + 一个配置 YAML + 一个 spc.registry.yml + 运行 spc。 -->

View File

@@ -0,0 +1,6 @@
# 生命周期 Hook
<!-- TODO: Hook 执行顺序与方法签名的详细说明。
#[BeforeStage('lib-name', 'build')]、#[AfterStage(...)]、#[PatchBeforeBuild]。
不同包的 Hook 如何合并与排序。
常见模式:修补 config.m4、注入编译标志、安装后修复。 -->

View File

@@ -0,0 +1,6 @@
# 编写 Package 类
<!-- TODO: 编写 Library 类和 Extension 类的分步指南。
使用 #[Library]、#[Extension]、#[BuildFor] 的完整注释代码示例。
UnixAutoconfExecutor / UnixCmakeExecutor / WindowsCMakeExecutor 用法。
文件放置位置src/Package/Library/、src/Package/Extension/)与自动加载。 -->