Composer: How to find the exact version of a package?

Suppose I write a library A, which depends on another library, for example, monolog.

I want to install the latest monologue, so just put this inside composer.json:

{ "require": { "monolog/monolog": "*.*.*" } } 

Then I ran $ php composer.phar install .

I expected to find the version installed inside composer.lock, but it is not there:

 { "hash": "d7bcc4fe544b4ef7561918a8fc6ce009", "packages": [ { "package": "monolog/monolog", "version": "dev-master", "source-reference": "2eb0c0978d290a1c45346a1955188929cb4e5db7" } ], "packages-dev": null, "aliases": [ ], "minimum-stability": "dev", "stability-flags": [ ] } 

I need a version because I want to bind my library to a specific set of versions, for example: If I find that version 1.3.5, in my composer.json I would like to add something like this:

  "require": { "monolog/monolog": "1.3.*" } 

Any ideas?

+43
php dependency-management composer-php package-managers
May 21 '12 at 11:38
source share
5 answers

I know this is an old question, but ...

 composer.phar show 

It will show all installed packages and information about them. (This was only shown in previous versions of Composer when using the deprecated -i option.)

For details, provide the package name:

 composer.phar show monolog/monolog 

This will show a lot of things, including MD5 hash code, source URL, license type, etc.

+92
Jan 15 '14 at 2:00
source share

Technically, "dev-master" is the exact version in which you used it. This is a development branch, and therefore the latest version.

The best place to find available versions for composer packages is Packagist , as the place composer downloads versions from the moment the packages are installed. Monological versions are listed at http://packagist.org/packages/monolog/monolog .

+1
May 21 '12 at 17:07
source share

Its a very old question, but by adding an answer so that it can help someone, you can also check it online by downloading the composer.josn and composer.lock file

http://www.drcomposer.com

Hope this can help someone.

+1
Mar 16 '17 at 6:54
source share

You can use composer as below:

 composer show package/name 
0
Oct 18 '17 at 11:27
source share

You can find them on github.

The composer is currently located at 1.1.0 https://github.com/Seldaek/monolog/tags

Just grab the tag that you think is the one you need.

-one
May 21 '12 at 11:46
source share



All Articles