作曲者:如何找到软件包的确切版本? [英] composer: How to find the exact version of a package?

查看:39
本文介绍了作曲者:如何找到软件包的确切版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我正在编写一个库A,该库依​​赖于另一个库,例如monolog.

Suppose I'm writing a library A, that depends on another library, monolog for instance.

我想安装最新版本的monolog,所以我将其放在composer.json中:

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

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

然后我运行 $ php composer.phar install .

我希望在composer.lock内找到已安装的版本,但是它不存在:

I was expecting to find the version installed, inside composer.lock, but it's not there:

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

    ],
    "minimum-stability": "dev",
    "stability-flags": [

    ]
}

我需要版本,因为我想将我的库绑定到一组特定的版本,例如:如果我发现版本是1.3.5,请在我的composer.json文件中输入以下内容:

I need the version because I want to tie my library to a specific set of versions, eg: If I find the version is 1.3.5, in my composer.json I would like to put something like this:

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

有什么想法吗?

推荐答案

我知道这是一个老问题,但是...

I know it's an old question, but...

composer.phar show

将显示所有当前安装的软件包及其版本信息.(仅当使用现在不建议使用的 -i 选项时,才在Composer的早期版本中显示此内容.)

Will show all the currently installed packages and their version information. (This was shown in previous versions of Composer only when using the now-deprecated -i option.)

要查看更多详细信息,请同时指定包的名称:

To see more details, specify the name of the package as well:

composer.phar show monolog/monolog

这将显示许多内容,包括提交MD5哈希,源URL,许可证类型等.

That will show many things, including commit MD5 hash, source URL, license type, etc.

这篇关于作曲者:如何找到软件包的确切版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆