我一直在我的本地机器上使用Symfony 2.1开发一个项目。我已经将它上传到我的服务器上,但是当我尝试使用Composer安装供应商包时,我得到了很多依赖错误。这大概与最新版本的Symfony刚刚发布和我的作曲家有关。Json文件没有指定确切的版本号。

有什么方法可以快速显示本地机器上所有内容的版本号吗?

这是我的作曲家。Json文件(直到几天前工作都很好):

{
    "name": "symfony/framework-standard-edition",
    "description": "The \"Symfony Standard Edition\" distribution",
    "autoload": {
        "psr-0": { "": "src/" }
    },
    "require": {
        "php": ">=5.3.3",
        "symfony/symfony": "2.1.*",
        "doctrine/orm": ">=2.2.3,<2.4-dev",
        "doctrine/doctrine-bundle": "1.0.*",
        "twig/extensions": "1.0.*",
        "symfony/assetic-bundle": "2.1.*",
        "symfony/swiftmailer-bundle": "2.1.*",
        "symfony/monolog-bundle": "2.1.*",
        "sensio/distribution-bundle": "2.1.*",
        "sensio/framework-extra-bundle": "2.1.*",
        "sensio/generator-bundle": "2.1.*",
        "jms/security-extra-bundle": "1.2.*",
        "jms/di-extra-bundle": "1.1.*",
        "sonata-project/admin-bundle": "*",
        "sonata-project/cache-bundle": "dev-master",
        "sonata-project/doctrine-orm-admin-bundle": "dev-master",
        "stof/doctrine-extensions-bundle": "1.1.x-dev",
        "sonata-project/user-bundle": "dev-master",
        "sonata-project/easy-extends-bundle": "dev-master",
        "friendsofsymfony/user-bundle": "2.0.x-dev",
        "friendsofsymfony/jsrouting-bundle": "*",
        "liip/imagine-bundle": "*",
        "simplethings/form-extra-bundle": "dev-master",
        "antimattr/google-bundle": "dev-master",
        "doctrine/doctrine-fixtures-bundle": "dev-master",
        "genemu/form-bundle": "2.1.*",
        "behat/behat":                  "2.4.*@stable",
        "behat/mink":                   "1.4.*@stable",
        "behat/symfony2-extension":     "*@stable",
        "behat/mink-extension":         "*@stable",
        "behat/mink-selenium2-driver":  "*@stable",
        "behat/mink-browserkit-driver":  "*",
        "liip/functional-test-bundle": "dev-master"
    },
    "scripts": {
        "post-install-cmd": [
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
        ],
        "post-update-cmd": [
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
        ]
    },
    "minimum-stability": "dev",
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web"
    },
    "config": {
        "bin-dir": "bin/"
    }
}

当前回答

这个命令的行为已经被修改,所以你不需要传递-i选项:

[10:19:05] coil@coil:~/workspace/api$ composer show -i
You are using the deprecated option "installed". 
Only installed packages are shown by default now. 
The --all option can be used to show all packages.

其他回答

Ivan的回答很好:

作曲家global show -i

附加信息:如果你收到类似这样的消息:

作曲家找不到作曲家。Json文件~/.composer

...您可能还没有安装任何包。如果是这样,您可以忽略消息的下一部分包含:

... 请创建一个作曲家。Json文件…

...因为一旦你安装了一个包,这个消息就会消失。

使用实例列出全局安装的编写器包:

composer global show -i

列出已安装的依赖项:

Flat:作曲家show -i 树:作曲家show -i -t

-i是——installed的缩写。

-t是——tree的缩写。

裁判:https://getcomposer.org/doc/03-cli.md

您可以运行composer show -i(——installed的缩写)。

在最新版本中只使用composer show。

-i选项已弃用。

您还可以使用composer的全局安装:composer全局显示

有没有办法通过$event->getComposer()->getRepositoryManager()->getAllPackages()