How to quickly find most recent versions for a package?

Published 3 years ago by BenSmith

What is the quickest way that you know, to find the most recently released version of a package? I know that I could go to Packagist and search for the package and it would probably take less than 10 seconds but I do this so often that if there is a better way, I would like to know!

My ideal solution would be something built into composer such that when I do for example:

 composer require phpspec/phpspec

Then as well as asking me for the version constraints, it would also show the 3 most recently tagged releases, so for this example it would show:

Please provide a version constraint for the phpspec/phpspec requirement (Most Recent: “2.1.*@dev" | 2.1.0-RC1 | 2.0.1)

This would save me a few seconds every time I had to add a package. Is there a solution already out there that I don’t know about?

Best Answer (As Selected By BenSmith)
lpadilla

composer show phpspec/phpspec

It will display all versions available

lpadilla

composer show phpspec/phpspec

It will display all versions available

BenSmith

Ughhh.... I looked through composers list of commands prior to posting because I was convinced that this functionality must already exist. I don't know how this didn't catch my eye, I think I need to go to bed.

Anyway, thanks very much!

BenSmith

Just in case anyone wants a quick way to find the most recent versions of a package from the command line. Add the following to your bashrc file (or similar)

alias ver='function _versions() { composer show $1 | grep versions }; _versions'

This allows you to use:

ver phpspec/phpspec

to return a list of the versions like so:

versions : dev-master, 2.1.x-dev, 2.1.0-RC1, * 2.0.1, 2.0.0, 2.0.0-RC4, 2.0.0-RC3, 2.0.0-RC2, 2.0.0-RC1, 2.0.0-BETA4, 2.0.0-BETA3, 2.0.0-BETA2, 2.0.0-BETA1, 1.4.3, 1.4.2, 1.4.1, 1.4.0

Please sign in or create an account to participate in this conversation.