symfony2.1.7编写器安装KnpPaginatorBundle

symfony2.1.7编写器安装KnpPaginatorBundle,symfony,composer-php,knppaginator,Symfony,Composer Php,Knppaginator,当我运行composer.phar安装时,一切看起来都很好: → sudo php composer.phar install Loading composer repositories with package information Installing dependencies (including require-dev) from lock file Nothing to install or update Generating autoload files Clearing the

当我运行composer.phar安装时,一切看起来都很好:

→ sudo php composer.phar install

Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
Clearing the cache for the dev environment with debug true
Installing assets using the hard copy option
Installing assets for Symfony\Bundle\FrameworkBundle into web/bundles/framework
Installing assets for FOS\JsRoutingBundle into web/bundles/fosjsrouting
etc etc
但是现在,我想安装这个包:从

因此,我用新的require行更新composer.json文件

{
"require": {
    "knplabs/knp-paginator-bundle": "v2.1"
}
}

(我试过packegist的每一个版本的paginator,但仍然是相同的错误)

然后我尝试安装它:

→ sudo php composer.phar install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for symfony/framework-standard-edition 2.1.x-dev -> satisfiable by symfony/framework-standard-edition[2.1.x-dev].
    - symfony/framework-standard-edition 2.1.x-dev requires knplabs/knp-paginator-bundle v2.1 -> no matching package found.

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.

Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
→ sudo php composer.phar安装
使用包信息加载composer存储库
从锁文件安装依赖项(包括需要开发)
警告:锁文件不是composer.json中最新更改的最新版本。您可能会得到过时的依赖项。运行update来更新它们。
无法将您的需求解析为可安装的软件包集。
问题1
-symfony/framework标准版2.1.x-dev的安装请求->可由symfony/framework标准版[2.1.x-dev]满足。
-symfony/framework standard edition 2.1.x-dev需要KNPLAB/knp paginator bundle v2.1->未找到匹配的包。
潜在原因:
-软件包名称中的输入错误
-根据您的最低稳定性设置,该软件包没有足够稳定的版本
有关更多详细信息,请参阅。
阅读了解更多常见问题。
以及当前composer.json的symfony2行:

    "require": {
    "php": ">=5.3.3",
    "symfony/symfony": "2.1.*",
    "doctrine/orm": ">=2.2.3,<2.4-dev",

"symfony/symfony": "2.1.x-dev" did not help
“需要”:{
“php”:“>=5.3.3”,
“symfony/symfony”:“2.1.*”,

“条令/orm”:“>=2.2.3,您应该在项目目录中运行此命令:

php composer.phar update

几个小时后,我终于找到了解决办法

我不知道我的composer.json依赖项是否处于最佳状态,但解决我问题的方法是只更新和安装所需的捆绑包

Wooot???我刚才说了什么???是的,只有所需的捆绑包,所以

sudo php composer.phar require 
然后,只需通过composer cool search从中查找您的愿望包

从列表中选择数字并填写版本

它将下载包, 更新composer.json和composer.lock文件:)

希望这个答案能帮助别人