Search code examples
phpgitcomposer-phppackagist

Getting "Could not find a version of package .." in composer inspite of having tags in Github branch of package


I am learning on how to upload a package on packagist.org. I created a github repository for testing with composer.json file - https://github.com/perials/check and a composer package using this github repository - https://packagist.org/packages/perials/check

When I try to install this package using composer require perials/check I get below error

[InvalidArgumentException]                                              
Could not find a version of package perials/check matching your minimum-stability (stable). Require it with an explicit version constraint allowing its desired stability.

From what I read in other related questions on SO this error occurs if there are no stable releases of github branch. But thing is that I already have some releases.

I also tried composer require perials/check:dev-master and composer require perials/check:7.1.0 but then I get below error

[InvalidArgumentException]             
Could not find package perials/check.  

Did you mean this?                     
perials/check

Solution

  • It was an issue with Singapore mirror for the packagist metadata. Now it should be resolved. https://github.com/composer/composer/issues/8347#issuecomment-537176755

    If still not solve your issue please add "minimum-stability": "dev" in your composer.json

    {
        "name": "perials/check",
        "description": "Package for testing packagist",
        "license": "MIT",
        "authors": [
            {
                "name": "Perials",
                "email": "[email protected]"
            }
        ],
        "autoload": {
            "psr-4": {"Abc\\": "src/xyz"}
        },
        "require": {},
        "minimum-stability": "dev"
    }