2

I am writing a php library and i published it on packagist but am unable to download it using composer

composer require merajsiddiqui/ibm-watson

But it throws error

  [InvalidArgumentException]                                                   
  Could not find package merajsiddiqui/ibm-watson at any version for your min  
  imum-stability (stable). Check the package spelling or your minimum-stabili  
  ty    

Here is my repository: https://github.com/merajsiddiqui/ibm-watson

I would be thankful if you can guide me to successfully publishing so any one can download this library.

Johannes
  • 64,305
  • 18
  • 73
  • 130
M A SIDDIQUI
  • 2,028
  • 1
  • 19
  • 24

4 Answers4

1

This is because your package is still in "dev" mode.

Add a tag to your repository, publish the tagged (versioned) repo.

Or add this to your composer.json:

"minimum-stability": "dev"

for example:

# composer.json
{
    "name": "ProjectUsingMyIBMWatsonPackage",
    "minimum-stability": "dev"
}

then run:

 $ composer require merajsiddiqui/ibm-watson
 Using version dev-master for merajsiddiqui/ibm-watson 
 (...)
   - Installing merajsiddiqui/ibm-watson (dev-master f7b808d) Cloning f7b808dd97 from cache
Community
  • 1
  • 1
Unamata Sanatarai
  • 6,475
  • 3
  • 29
  • 51
  • in which composer i have to add the minimum stability .. as i added in ibm-watson repo and tried to install it shows same error do i have to add in the compose.json where i am trying to download it ..? – M A SIDDIQUI Mar 21 '17 at 12:16
  • In the project you want to use your library in. – Unamata Sanatarai Mar 21 '17 at 12:18
  • 1
    Downgrading minimum-stability may work for you in this one case, but is a bad idea; just tag your versions. – Narf Mar 21 '17 at 12:32
  • What Narf said ;) – Unamata Sanatarai Mar 21 '17 at 12:33
  • At least, if you really need to use the development version of a particular package, please do not lower the `minimum-stability` flag for all your dependencies, but rather explicitly require the dev version of this particular package: `composer require merajsiddiqui/ibm-watson:dev-master` – xabbuh Mar 21 '17 at 13:33
1

minimum-stability: stable means that development versions of the library cannot be installed - that's the default minimum-stability setting. And for good reasons - a "dev" version changes constantly, and is thus unreliable.

You need to release an actual (non-RC, non-alpha, non-beta) version of your library for it to be considered "stable".

With Git, that means using git tag.

Narf
  • 14,600
  • 3
  • 37
  • 66
0

Go to:

https://packagist.org/

and create a package from your repo. Then it's available. Otherwise you have to add your repo in your composer configuration manually.

https://getcomposer.org/doc/05-repositories.md

The other problem is that your package is not marked es "stable" then your can't add them when your minimum stability is stable. So go to your composer.json and set them to stable.

How to mark code as stable using Composer?

René Höhle
  • 26,716
  • 22
  • 73
  • 82
0

Add "minimum-stability": "dev" in your composer json file or release version of your library.

Sohel Rana
  • 567
  • 5
  • 10