jclg / php-slack-bot

Slack bot user written in PHP
MIT License
169 stars 61 forks source link

Minimum stability #29

Closed gugglegum closed 6 years ago

gugglegum commented 6 years ago

Installing of this package requires setting minimum stability to "dev". This is not good idea if you package is stable enough. This setting is global. But I don't want any other packages to be installed with dev-stability level. It should be better if you require dev package as following:

    "require": {
        "devristo/phpws": "dev-master@dev",
        "react/http": "^0.4"
    },

This will not require global minimum stability set to "dev".

jclg commented 6 years ago

Hello,

Thank you for reporting this issue. I set a stability flag as you suggested https://github.com/jclg/php-slack-bot/commit/a18d496bf099b57ab8c2b6fe7e37c5b78be6eebc

Unfortunately, it doesn't seem to work

composer require jclg/php-slack-bot
...
Using version ^0.0.5 for jclg/php-slack-bot
Your requirements could not be resolved to an installable set of packages.
...
jclg/php-slack-bot 0.0.5 requires devristo/phpws dev-master@dev -> no matching package found.

Maybe I am missing something ?

gugglegum commented 6 years ago

You're right. Something here is not as I expected. This solution helped me in other situations but not here. I see fast solution in explicit defining stability for dependent dev package in root composer.json. Like this:

    ...
    "require": {
        "jclg/php-slack-bot": "*",
        "devristo/phpws": "@dev"
    },
    ....

Tomorrow I will investigate it deeper. Maybe I will find better solution of this problem.

gugglegum commented 6 years ago

The fast solution I proposed above is only solution to install your package without changing minimum-stability to dev. I was wrong when I offered you to add "@dev" to package version in require section. This trick works only for root packages, i.e. when you need to add in your app one dev-package with minimum-stability=stable. For 2nd level dependencies this doesn't work.

There's 2 variants of installation:

  1. Explicitly specify "@dev" stability for dev-package in root composer.json (my fast solution above).
  2. Set minimum-stability to "dev". And I recommend to add also "prefer-stable" : true. This will install dev version of packages only if stable version not exists.

You may add both examples to README to give user a choice.

jclg commented 6 years ago

Thank you for your help and your suggestions.

I ended up using a fork with a stable release of the same package https://github.com/semako/phpws I updated the installation instructions in the README file.