diff --git a/docs/en/develop/source-module.md b/docs/en/develop/source-module.md index 4b1b1fc0..51c3ba3c 100644 --- a/docs/en/develop/source-module.md +++ b/docs/en/develop/source-module.md @@ -36,6 +36,7 @@ The following is the source download configuration corresponding to the `libeven The most important field here is `type`. Currently, the types it supports are: - `url`: Directly use URL to download, for example: `https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz`. +- `pie`: Download PHP extensions from Packagist using the PIE (PHP Installer for Extensions) standard. - `ghrel`: Use the GitHub Release API to download, download the artifacts uploaded from the latest version released by maintainers. - `ghtar`: Use the GitHub Release API to download. Different from `ghrel`, `ghtar` is downloaded from the `source code (tar.gz)` in the latest Release of the project. @@ -89,6 +90,37 @@ Example (download the imagick extension and extract it to the extension storage } ``` +## Download type - pie + +PIE (PHP Installer for Extensions) type sources refer to downloading PHP extensions from Packagist that follow the PIE standard. +This method automatically fetches extension information from the Packagist repository and downloads the appropriate distribution file. + +The parameters included are: + +- `repo`: The Packagist vendor/package name, such as `vendor/package-name` + +Example (download a PHP extension from Packagist using PIE): + +```json +{ + "ext-example": { + "type": "pie", + "repo": "vendor/example-extension", + "path": "php-src/ext/example", + "license": { + "type": "file", + "path": "LICENSE" + } + } +} +``` + +::: tip +The PIE download type will automatically detect the extension information from Packagist metadata, +including the download URL, version, and distribution type. +The extension must be marked as `type: php-ext` or contain `php-ext` metadata in its Packagist package definition. +::: + ## Download type - ghrel ghrel will download files from Assets uploaded in GitHub Release. diff --git a/docs/zh/develop/source-module.md b/docs/zh/develop/source-module.md index 00feb3c4..769ffa08 100644 --- a/docs/zh/develop/source-module.md +++ b/docs/zh/develop/source-module.md @@ -30,6 +30,7 @@ static-php-cli 的下载资源模块是一个主要的功能,它包含了所 这里最主要的字段是 `type`,目前它支持的类型有: - `url`: 直接使用 URL 下载,例如:`https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz`。 +- `pie`: 使用 PIE(PHP Installer for Extensions)标准从 Packagist 下载 PHP 扩展。 - `ghrel`: 使用 GitHub Release API 下载,即从 GitHub 项目发布的最新版本中上传的附件下载。 - `ghtar`: 使用 GitHub Release API 下载,与 `ghrel` 不同的是,`ghtar` 是从项目的最新 Release 中找 `source code (tar.gz)` 下载的。 - `ghtagtar`: 使用 GitHub Release API 下载,与 `ghtar` 相比,`ghtagtar` 可以从 `tags` 列表找最新的,并下载 `tar.gz` 格式的源码(因为有些项目只使用了 `tag` 发布版本)。 @@ -77,6 +78,36 @@ url 类型的资源指的是从 URL 直接下载文件。 } ``` +## 下载类型 - pie + +PIE(PHP Installer for Extensions)类型的资源是从 Packagist 下载遵循 PIE 标准的 PHP 扩展。 +该方法会自动从 Packagist 仓库获取扩展信息,并下载相应的分发文件。 + +包含的参数有: + +- `repo`: Packagist 的 vendor/package 名称,如 `vendor/package-name` + +例子(使用 PIE 从 Packagist 下载 PHP 扩展): + +```json +{ + "ext-example": { + "type": "pie", + "repo": "vendor/example-extension", + "path": "php-src/ext/example", + "license": { + "type": "file", + "path": "LICENSE" + } + } +} +``` + +::: tip +PIE 下载类型会自动从 Packagist 元数据中检测扩展信息,包括下载 URL、版本和分发类型。 +扩展必须在其 Packagist 包定义中标记为 `type: php-ext` 或包含 `php-ext` 元数据。 +::: + ## 下载类型 - ghrel ghrel 会从 GitHub Release 中上传的 Assets 下载文件。首先使用 GitHub Release API 获取最新版本,然后根据正则匹配方式下载相应的文件。