Repository navigation
Add PECL download type and support for PECL artifacts - #1045
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a new pecl artifact download type to fetch and extract PHP extensions from PECL, updates extension configs to use it, and adjusts network command defaults to be more resilient for long-running downloads/clones.
Changes:
- Add
peclas a supported artifact source type (config validation + downloader registration) and implementStaticPHP\Artifact\Downloader\Type\PECL. - Update curl/git invocation defaults (timeouts, git low-speed settings) and shorten git-derived version hashes.
- Consolidate several built-in extension package definitions into
builtin-extensions.ymland switch some PECL-hosted extensions totype: pecl.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/StaticPHP/Runtime/Shell/DefaultShell.php | Adds curl max-time, optional --compressed, and git clone low-speed settings. |
| src/StaticPHP/Config/ConfigValidator.php | Adds pecl to artifact type validation rules. |
| src/StaticPHP/Artifact/Downloader/Type/PECL.php | New downloader that queries PECL REST releases and downloads the selected tarball. |
| src/StaticPHP/Artifact/Downloader/Type/Git.php | Uses short git hashes for version strings and update checks. |
| src/StaticPHP/Artifact/ArtifactCache.php | Changes JSON encoding flags for cache persistence. |
| config/pkg/ext/ext-readline.yml | Removed; definition moved into builtin-extensions.yml. |
| config/pkg/ext/ext-phar.yml | Removed; definition moved into builtin-extensions.yml. |
| config/pkg/ext/ext-mbstring.yml | Removed; definition moved into builtin-extensions.yml. |
| config/pkg/ext/ext-mbregex.yml | Removed; definition moved into builtin-extensions.yml. |
| config/pkg/ext/ext-ast.yml | Adds PECL-based artifact source for ext-ast. |
| config/pkg/ext/ext-apcu.yml | Switches APCu artifact source from direct URL to type: pecl. |
| config/pkg/ext/ext-amqp.yml | Switches amqp artifact source from direct URL to type: pecl. |
| config/pkg/ext/builtin-extensions.yml | Adds several built-in extension definitions previously in separate files. |
| config/downloader.php | Registers the new pecl downloader type. |
Comments suppressed due to low confidence (1)
src/StaticPHP/Artifact/Downloader/Type/Git.php:90
checkUpdate()truncates the remote hash to 7 characters, but the stored version/hash format may contain a different-length short hash (fromrev-parse --short) or a full 40-char hash from older cache entries. Align the hash length/format so update checks don't always trigger after upgrading to this change.
$new_hash = substr($result[1][0], 0, 7);
$new_version = "dev-{$config['rev']}+{$new_hash}";
// Extract stored hash from "dev-{rev}+{hash}", null if bare mode or old format without hash
$old_hash = ($old_version !== null && str_contains($old_version, '+')) ? substr(strrchr($old_version, '+'), 1) : null;
return new CheckUpdateResult(
old: $old_version,
new: $new_version,
needUpdate: $old_hash === null || $new_hash !== $old_hash,
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Checklist before merging
*.phpor*.json, run them locally to ensure your changes are valid:composer cs-fixcomposer analysecomposer testbin/spc dev:sort-configsrc/globals/test-extensions.php.extension testortest extensionsto trigger full test suite.