我一直在我的本地机器上使用Symfony 2.1进行项目。我已将其上传到我的服务器但是当我尝试使用Composer安装供应商软件包时,我遇到了很多依赖性错误。据推测,这与刚刚发布的最新版本的Symfony和我的composer.json
文件没有指定确切的版本号有关。
有什么办法可以快速显示本地机器上所有内容的版本号吗?
这是我的composer.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/"
}
}
答案 0 :(得分:430)
您可以运行composer show -i
(--installed
的缩写)。
在最新版本中,只需使用composer show
。
已弃用-i
选项。
您还可以使用作曲家的global
安装:composer global show
答案 1 :(得分:41)
列出全局安装的编辑器包:
composer global show -i
答案 2 :(得分:11)
列出已安装的依赖项:
composer show -i
composer show -i -t
-i
--installed
的缩写。
-t
--tree
的缩写。
答案 3 :(得分:11)
此命令的行为已被修改,因此您无需传递-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.
答案 4 :(得分:6)
伊万的答案很好:
composer global show -i
添加信息:如果您收到的消息有点像:
Composer could not find a composer.json file in ~/.composer
...您可能还没有安装软件包。如果是这样,您可以忽略包含以下内容的消息的下一部分:
... please create a composer.json file ...
...一旦你安装了一个包,消息就会消失。
答案 5 :(得分:6)
如果您只想检查一个版本,可以
composer show -- twig/twig
请注意,现在默认只显示已安装的软件包,现在已弃用已安装的软件包。
答案 6 :(得分:2)
如果您要安装Symfony2.2,您可以在composer.json
on the Symfony blog中看到完整的更改。
只需根据该文件更新您的文件,然后运行composer update
。这将在您的项目中安装所有新的依赖项和Symfony2.2。
如果你不想更新到Symfony2.2,但是有依赖性错误,你应该发布这些,所以我们可以帮助你。
答案 7 :(得分:0)
是否可以通过$ event-> getComposer()-> getRepositoryManager()-> getAllPackages()
来获取它