Install latest stable version rather than dev-master

When I try to install https://packagist.org/packages/phplicengine/bitly simply by
composer require phplicengine/bitly it installs dev-master rather than the latest version. why? Isn’t it because of ‘v’ in its version? ‘v’ better not be used in GitHub tags?

When I try to replicate this, it happens when I have the following in my composer.json:

{
   "minimum-stability": "dev"
}

When I then require phplicengine/bitly it will indeed install dev-master.
However, when I either

  1. remove that line, or
  2. change the minimum-stability to stable (which is the default value), or
  3. add "prefer-stable": true to composer.json

Then in all of those cases it will install version ^1.0 rather than dev-master.

See https://getcomposer.org/doc/04-schema.md#minimum-stability for more information. The section for prefer-stable is right below it.

So it doesn’t have anything to do with v in version numbers?
I don’t have neither below to enforce installing dev.
{ "minimum-stability": "dev" }
I saw many packages that they install latest stable version instead of dev, but they don’t have those commands you mentioned, neither.
for example see this one: https://github.com/doctrine/cache/blob/1.10.x/composer.json
it doesn’t have any composer json commands you mentioned but it still installs the latest version. Why?
Please advise.

Oops, it seems we are talking about different things. The solution you said, is for end-user I think. But I was talking as developer, to let composer of my end-users installs stable version by default as I gave doctrine/cache as composer sample.

Nope.

Yes, it’s about what’s in the composer.json of the project where composer require is being run in. Whatever is in the composer.json of the package being installed is irrelevant.

As far as I know you can’t, you have no control over that. Why do you want this? What is your concern?

So why my end-users should install dev version? and what is the purpose of GitHub tag, if it still installs dev? and how and why other packages are being installed with latest version/tag rather than dev?

They should do whatever they want. If they want dev versions they should install dev versions (and deal with any consequences).

It only installs dev if you indicate you’re okay with unstable dependencies, which is not the default in composer.

Probably because people have set the minimum stability to stable.

Ultimately people get to decide which version they install, that’s just the way it is :man_shrugging:

“Probably because people have set the minimum stability to stable.”

As about myself as user, I did not change anything default in my composer but when I want to install doctrine/orm it installs the latest tag, but when I want to install phplicengine/bitly, it installs dev version. why this should happen as I did not change anything default in my composer?

What is in your composer.json? It’s rather hard to know why composer does certain things without knowing how you’ve configured it.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.