phar-io / composer-distributor

Distribute PHAR files via Composer
Other
12 stars 2 forks source link

Support Composer Mirrors #27

Open sprankhub opened 4 months ago

sprankhub commented 4 months ago

We use captainhook/captainhook-phar, which uses phar-io/composer-distributor. We wondered why sometimes, in CI, we get a GitHub timeout even though we use Private Packagist as a mirror. What we've seen:

- Installing captainhook/captainhook-phar (5.22.2): Extracting archive
WARNING
No GPG installation found! Use installed PHARs with care.
Consider installing GnuPG to verify PHAR authenticity.
If you need help installing GnuPG visit http://phar.io/install-gnupg
- Downloading artifact from https://github.com/captainhookphp/captainhook/releases/download/5.22.2/captainhook.phar
In Download.php line 26:

fopen(https://github.com/captainhookphp/captainhook/releases/download/5.22.
2/captainhook.phar): Failed to open stream: Connection timed out

However, our composer.lock file clearly defines a mirror for this package:

    {
        "name": "captainhook/captainhook-phar",
        "version": "5.22.2",
        "source": {
            "type": "git",
            "url": "https://github.com/captainhookphp/captainhook-phar.git",
            "reference": "055e6e109170a1d79353f9c94a6099e08bab15cd"
        },
        "dist": {
            "type": "zip",
            "url": "https://api.github.com/repos/captainhookphp/captainhook-phar/zipball/055e6e109170a1d79353f9c94a6099e08bab15cd",
            "reference": "055e6e109170a1d79353f9c94a6099e08bab15cd",
            "shasum": "",
            "mirrors": [
                {
                    "url": "https://repo.packagist.com/company/project/dists/%package%/%version%/r%reference%.%type%",
                    "preferred": true
                }
            ]
        },
        "require": {
            "composer-plugin-api": "^1.1||^2.0",
            "ext-json": "*",
            "ext-spl": "*",
            "phar-io/composer-distributor": "^1.0",
            "php": "^8.0 || ^8.1 || ^8.2"
        },
        "require-dev": {
            "composer/composer": "^1.1 || ^2.0"
        },
        "type": "composer-plugin",
        "extra": {
            "class": "CaptainHook\\Composer\\Plugin"
        },
        "autoload": {
            "psr-4": {
                "CaptainHook\\Composer\\": "src/"
            }
        },
        "notification-url": "https://repo.packagist.com/company/project/downloads/",
        "license": [
            "MIT"
        ],
        "authors": [
            {
                "name": "Sebastian Feldmann",
                "email": "sf@sebastian-feldmann.info"
            }
        ],
        "description": "PHP git hook manager",
        "homepage": "https://github.com/captainhookphp/captainhook",
        "keywords": [
            "commit-msg",
            "git",
            "hooks",
            "post-merge",
            "pre-commit",
            "pre-push",
            "prepare-commit-msg"
        ],
        "support": {
            "issues": "https://github.com/captainhookphp/captainhook/issues",
            "source": "https://github.com/captainhookphp/captainhook-phar/tree/5.22.2"
        },
        "funding": [
            {
                "url": "https://github.com/sponsors/sebastianfeldmann",
                "type": "github"
            }
        ],
        "time": "2023-12-13T23:08:05+00:00"
    }

Since the mirror is defined, the package should be downloaded from repo.packagist.com and not from github.com.

Would you be able to support this? :face_with_peeking_eye: :pray: