Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Composer/Packagist could not find package for minimum stability

I'm trying to install the following composer package:

composer require cr/hashcli

it is a package that I did. But when I try to install it I get the following error:

[InvalidArgumentException] Could not find package cr/hashcli at any version for your minimum-stability (stable). Check the package spelling or your minimum-stability

My composer.json is the following:

{
"name": "cr/hashcli",
"description": "HashCLI - PHP CLI Tool For hashing",
"type": "library",
"keywords": ["hash", "cli"],
"license": "MIT",
"require": {
    "php": ">=5.5"
},
"require-dev": {
    "phpunit/phpunit": "^5.7"
},
"bin":[
    "src/hashCLI"
],
"autoload": {
    "classmap": [
        "src/"
    ]
},
"autoload-dev": {
    "classmap": [
        "tests/"
    ]
}
}

Any idea on why this is happening and how can I solve this problem?

like image 218
Cláudio Ribeiro Avatar asked Dec 14 '16 18:12

Cláudio Ribeiro


3 Answers

There is no stable version of this package. Use

composer require cr/hashcli:dev-master
like image 114
Bizley Avatar answered Nov 03 '22 12:11

Bizley


Since you mentioned that you are the author of the package you should create a release if you think that your version may be used in production.

You can do this at GitHub:

  1. Click on 0 releases enter image description here

  2. Create a new release enter image description here

  3. Create a release version, perhaps v1.0, add a description and push the button: enter image description here

  4. Try to reinstall with composer. Make sure to remove the cahce first composer clear-cache and then just try composer require your/pagackge.


Sidenote:

I recommend you to read this to understand when you should name a release v1.0.1 or v1.1 or v.2.0-alpha etc. Here is a little excerpt:

  1. Once a versioned package has been released, the contents of that version MUST NOT be modified. Any modifications MUST be released as a new version.

In other words, if you push something to your repository and you do not create another release. People are only able to download the latest release through composer.

6.Patch version Z (x.y.Z | x > 0) MUST be incremented if only backwards compatible bug fixes are introduced. A bug fix is defined as an internal change that fixes incorrect behavior.

For bug fixes that are not breaking anything you may update to v1.0.1

7.Minor version Y (x.Y.z | x > 0) MUST be incremented if new, backwards compatible functionality is introduced to the public API. It MUST be incremented if any public API functionality is marked as deprecated. [...]

If you add new functionality that does not break the code you should call the next release v1.1.0.

8.Major version X (X.y.z | X > 0) MUST be incremented if any backwards incompatible changes are introduced to the public API.

If you do something that may breaks the code from other people, you may call the new release v2.0

9.A pre-release version MAY be denoted by appending a hyphen and a series of dot separated identifiers immediately following the patch version. Identifiers MUST comprise only ASCII alphanumerics and hyphen [0-9A-Za-z-].

Anything called v1.3-alpha or v1.3-christmas will be seen as a pre-release.

like image 22
Adam Avatar answered Nov 03 '22 14:11

Adam


If you want to be able to install dev packages you can change your composer config for that project:

composer config minimum-stability dev
composer config prefer-stable true
like image 9
Gareth Avatar answered Nov 03 '22 12:11

Gareth