You must install KnpPaginatorBundle in the project on Symfony 2.7. The documentation suggests installing with the composer require knplabs/knp-paginator-bundle command composer require knplabs/knp-paginator-bundle , but I want to install it through the composer.json file. The problem is that when I add lines to composer.json :

 "require": { ... "knplabs/knp-paginator-bundle": "^2.5" }, 

When you call the php composer.phar update command, an error is issued that it cannot find any version of knp-paginator-bundle .

  • and tried? php composer.phar require knplabs/knp-paginator-bundle - VasyOk
  • Yes, this is how everything is installed, I just do not quite understand, if I want to install my project on a friend's car, will it be necessary for me to install the paginator again in this way? - Kostiantyn Okhotnyk
  • not. there you will need to make php composer.phar install in the project root and the composer will do everything by the rules of composer.json - VasyOk
  • I figured it out, you need to install paginator with the php composer.phar require knplabs / knp-paginator-bundle command, and in composer.json add "require": {... "knplabs / knp-paginator-bundle": "^ 2.5"} , and then, when you need to update or install, will the paginator be automatically installed? - Kostiantyn Okhotnyk
  • when you do php composer.phar require knplabs/knp-paginator-bundle composer itself will add the necessary line to composer.json after the transfer to run only php composer.phar install and that's it. Since the rules are already formed in composer.json (the main thing is not to forget to transfer it) - VasyOk

1 answer 1

This error tells you that you have conflicting versions of other libraries. It is possible that in your composer.json there is a hard peg to the version of any library that is used in the KnpPaginatorBundle . Look in the direction of the versions of such libraries:

 symfony/framework-bundle: ~2.3 knplabs/knp-components: ~1.2 

When you start composer require knplabs/knp-paginator-bundle , Composer automatically selects the most convenient version for you, starting with the current stable (by default). As soon as the necessary package is found, the entry is entered into composer.lock with the version found.

To check the spelling of the version (whether it will generally refer to the working repository), you can test it on the site http://semver.mwl.be/ .