0

I'm using the acelaya/zf2-acqrcode package (v0.2.0) It requires "endroid/qrcode": ">=1.2.0", (meaning everything higher than or equal to 1.2.0)

Currently the latest version of the "endroid/qrcode" package = v3.2.12

The acelaya/zf2-acqrcode package (v0.2.0) uses a function that doesn't exist anymore in endroid/qrcode versions > 1.9.3

Is there any way I can tell composer not to install a version of the endroid/qrcode package higher than 1.9.3?

mattyh88
  • 1,585
  • 5
  • 26
  • 48
  • Have you tried this ? https://stackoverflow.com/questions/40914114/how-to-install-a-specific-version-of-package-using-composer – Ivan Milosevic Jun 14 '18 at 12:50
  • I can't set the acelaya/zf2-acqrcode package requirements .. Your suggestion will only work for packages that I require for my application. (meaning: If I would require the endroid/qrcode package in my project composer.json file) – mattyh88 Jun 14 '18 at 12:52

2 Answers2

1

Yes you can restrict the package versions by using the ~ operator in composer.json. More Information on that can be found Here

Hope this helps.

Kishen Nagaraju
  • 2,062
  • 9
  • 17
0

Use the following to lock the endroid/qrcode dependency to 1.9.3. Sub dependencies will adhere to this and honour the fact you've locked acelaya/zf2-acqrcode.

Note: this will only fail when another dependency requires >1.9.3 of endroid/qrcode

{
    "require": {
        "endroid/qrcode": "1.9.3",
        "acelaya/zf2-acqrcode": "^1.0"
    }
}

Run the command following command:

/path/to/composer.phar require endroid/qrcode:1.9.3

Here's the output of the above required dependencies:

$ composer install                                                     
Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 18 installs, 0 updates, 0 removals
  - Installing zendframework/zend-stdlib (3.2.0): Loading from cache
  - Installing zendframework/zend-loader (2.6.0): Loading from cache
  - Installing zendframework/zend-eventmanager (3.2.1): Loading from cache
  - Installing zendframework/zend-view (2.10.0): Loading from cache
  - Installing psr/container (1.0.0): Loading from cache
  - Installing container-interop/container-interop (1.2.0): Loading from cache
  - Installing zendframework/zend-servicemanager (3.3.2): Loading from cache
  - Installing zendframework/zend-validator (2.10.2): Loading from cache
  - Installing zendframework/zend-escaper (2.6.0): Loading from cache
  - Installing zendframework/zend-uri (2.6.1): Loading from cache
  - Installing zendframework/zend-http (2.8.0): Loading from cache
  - Installing zendframework/zend-router (3.0.2): Loading from cache
  - Installing zendframework/zend-config (3.2.0): Loading from cache
  - Installing zendframework/zend-modulemanager (2.8.2): Loading from cache
  - Installing zendframework/zend-mvc (3.1.1): Loading from cache
  - Installing symfony/options-resolver (v3.4.11): Loading from cache
  - Installing endroid/qrcode (1.9.3): Loading from cache
  - Installing acelaya/zf2-acqrcode (v1.0.0): Loading from cache
steadweb
  • 15,364
  • 3
  • 33
  • 47
  • if you are not really requiring this third party library i would not add it to the require part. maybe you could add it to the conflict section in composer? and anyway report this bug to the maintainer of acelaya/zf2-acqrcode – Norman M Jun 14 '18 at 13:25
  • That's the preferred approach, but this will get around that issue, especially as the OP isn't a maintainer of said package. – steadweb Jun 14 '18 at 13:37
  • adding it to his composer.json conflict section will get the OP around that issue – Norman M Jun 19 '18 at 12:50
  • Then suggest that as an answer. – steadweb Jun 19 '18 at 13:27