andymcgregor
andymcgregor

Reputation: 1015

How in Composer.phar to install some package with latest version?

For example if I does not know which version are exists in package, and author does not specify versions in README, how could I install just latest version? composer.phar install vendor/package ?

Upvotes: 0

Views: 207

Answers (1)

Sven
Sven

Reputation: 70913

I believe this is impossible. You have to know at least SOMETHING about the software you are about to use.

Information in this regard would be:

  • Any existing tags in the source repository
  • Alternatively any existing branches in this repository
  • If you do not know the repository location, you would have to use downloading of a package (ZIP, TGZ), which needs a dedicated version number.

You probably use packagist.org for downloading the software - you'll find the recognized versions of the software on this site.

Installing any tagged software version would mean you want to add "*" as the version requirement, but this will only work if there is at least one tagged version. Remember however that this declaration will upgrade your library mercilessly from 0.1 to 3.0 together with all incompatible changes that happened in 1.x and 2.x versions if you ever fetch an upgrade. This is usually not what you want if your software is supposed to work after the update.

If there isn't any tagged version, or if you find this version to be too old, you may switch to use the head of any branch in the repository, but which branch to choose depends on the layout of the source repository, i.e. you have to know which branch is used for the development of your choice - and this will probably also not being mentioned in the readme. Additionally, you'll have to allow for development versions by stating a certain stability requirement using minimum-stability (doc) or adding it in the required version (doc)

Upvotes: 1

Related Questions