Search code examples
phplaravelcomposer-phplaravel-package

Could not find a version of package matching your minimum-stability. Require it with an explicit version constraint allowing its desired stability


I've created a package (innovareti/password-policy) and now I am trying to install it, but it is not found:

$ composer require innovareti/password-policy
...
  [InvalidArgumentException]                              
  Could not find a version of package innovareti/password-policy
  matching your minimum-stability (dev). Require it with an explicit
  version constraint allowing its desired stability.

(this error keeps ocurring)

It does have a tag and a release, and I've updated it in packagist but it's still not working, even after the update on packagist is done already for a couple of minutes and I can see it there fine.

This is the composer.json of the package:

{
  "name": "innovareti/password-policy",
  "description": "A library to intuitively create password policies and validate a subject against them.",
  "autoload": {
    "psr-4": {
      "PasswordPolicy\\Tests\\": "tests/",
      "PasswordPolicy\\": "src/PasswordPolicy/",
      "PasswordPolicy\\Database\\Factories\\": "database/factories",
      "PasswordPolicy\\Models\\": "src/Models"
    }
  },
  "extra":{
    "laravel": [
      "src/PasswordPolicy/Providers/Laravel/PasswordPolicyServiceProvider"
    ]
  },
  "require": {
    "php": "^5.5"
  },
  "scripts": {
    "test": "vendor/bin/phpunit",
    "test-f": "vendor/bin/phpunit --filter"
  },
  "minimum-stability": "dev"
}

My repository is at: https://github.com/innovareti/password-policy

I've tried many things I saw online but nothing worked, can anyone help me?


Solution

  • Apparently the problem was that new packages published to packagist need to be installed with composer on version 21.

    I ran composer selfupdate --2 to update my version of composer which was 1.x.

    Then required my package by running composer require innovareti/password-policy and it worked.


    1. Compare "Restricted access to unused packages via the v1 metadata API starting in May 2021" in Deprecating Packagist.org support for Composer 1.x ( Jordi Boggiano for packagist.org; Feb 2021)

    Further References