Skip to content

Add PECL download type and support for PECL artifacts - #1045

Merged
crazywhalecc merged 1 commit into
v3-feat/check-updatefrom
v3-feat/pecl-down
Mar 4, 2026
Merged

crazywhalecc merged 1 commit into
v3-feat/check-updatefrom
v3-feat/pecl-down

Conversation

@crazywhalecc

Copy link
Copy Markdown
Owner

What does this PR do?

Checklist before merging

If your PR involves the changes mentioned below and completed the action, please tick the corresponding option.
If a modification is not involved, please skip it directly.

  • If you modified *.php or *.json, run them locally to ensure your changes are valid:
    • composer cs-fix
    • composer analyse
    • composer test
    • bin/spc dev:sort-config
  • If it's an extension or dependency update, please ensure the following:
    • Add your test combination to src/globals/test-extensions.php.
    • If adding new or fixing bugs, add commit message containing extension test or test extensions to trigger full test suite.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 pecl as a supported artifact source type (config validation + downloader registration) and implement StaticPHP\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.yml and switch some PECL-hosted extensions to type: 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 (from rev-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.

@crazywhalecc
crazywhalecc merged commit dc0a809 into v3-feat/check-update Mar 4, 2026
5 checks passed
@crazywhalecc
crazywhalecc deleted the v3-feat/pecl-down branch March 4, 2026 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants