Skip composer PHP requirement

composer install
composer require-dev
composer install skip package
composer clear-cache
ignore system requirements composer
composer update to specific version
composer self-update
composer ignore replace

We are using PHPCI and composer. The server which runs PHPCI is on PHP 5.3.

For a project we added the Facebook PHP SDK, using composer. It requires PHP 5.4. Composer gets triggered by PHPCI and get executed. But because the CI server just got PHP 5.3 composer failed with the error message:

facebook/php-sdk-v4 4.0.9 requires php >=5.4.0 -> no matching package found.

This let fail my build in PHPCI, of course.

Is there a possibility to skip this requirement? Maybe by adding an option to composer.json? Or a parameter to composer.phar call?

I've found the option:

composer install --ignore-platform-reqs

Ignore platform requirements (php & ext- packages).


Edit: You can skip the platform checks with this, but Composer will fetch packages based on given PHP version then. So when you need composer to also emulate a PHP version during depedency resolving, you can (and should!) use this in your composer.json:

{
    "config": {
       "platform": {
           "php": "5.6.6"
       }
    }
}

https://getcomposer.org/doc/06-config.md#platform

How to install Composer packages ignoring PHP version requirements, Composer already has a --ignore-platform-reqs option (notice the s in reqs ), but it ignores all platform requirements, including PHP version,� Composer gets triggered by PHPCI and get Skip composer PHP requirement @ UrlSave We are using PHPCI and composer. The server which runs PHPCI is on PHP 5.3. For a project we added the Facebook PHP SDK, using composer.

For many commands, you can tell composer to bypass php version check, with parameter "--ignore-platform-reqs":

composer COMMAND --ignore-platform-reqs

this will bypass php version specification.

Be aware that the software may work or not: php version specification is there because somewhere in the code is needed at least the specified php version, so if you use that code the software will break.

Command-line interface / Commands, --ignore-platform-reqs: ignore php , hhvm , lib-* and ext-* requirements and force the installation php composer.phar update vendor/package vendor/package2. composer config platform.php 5.6.1. This will set the platform option in the composer.json file for us. In this example it would add PHP 5.6.1 to the JSON file just like in the previous example. You can also use the -g flag to set this globally. On a Composer package platform requirements are added just like package dependencies.

If anything requires a specific version of PHP, it won't run in a lower version of PHP. You will properbly still recieve errors when bypassing the PHP requirement.

Btw, PHP 5.3 is no longer maintained, I would strongly recommend updating the PHPCI server.

Option to ignore requirements when installing � Issue #1426 , However, if you're using Vagrant, or a setup where the version of PHP you're using to work with Composer isn't the one that'll be used to run your� Latest composer now has --ignore-platform-reqs in update and install to ignore php, hhvm and ext-* requirements. 👍 7 🎉 2 Seldaek closed this Oct 17, 2014

RFE --ignore-platform-reqs to respect php version � Issue #5900 , So, I run (in CI one step) composer install --ignore-platform-reqs because i don't want to spend time install extension dependencies, those are� Which worked fine, until a dependency update meant I didn’t have the correct php version. This caused composer to update to an older version of Drupal (Drupal 8.4.8 rather than Drupal 8.5.3), and this output when I forced composer to update to Drupal 8.5.x:

Composer require specific version while ignoring package , Note: there's a --ignore-platform-reqs flag, but that doesn't allow you to force overwrite package requirements, just skip local PHP version or� Composer already has a --ignore-platform-reqsoption (notice the sin reqs), but it ignores allplatform requirements, including PHP version, extensions (ext-*), and composer-plugin-api. The new --ignore-platform-reqoption can be used to set specific requirements that Composer can ignore. Ignore multiple platform requirements

Enforcing a PHP Version for Installed Composer Packages, We can tell Composer what version of PHP we are supporting with our packages you may at times want to ignore the platform requirements. Step 1: Once the file is downloaded you just run the installation Wizard. Keep the default settings as it is by ignoring Step 2: Now the new popup will come to confirm the PHP command line location. Choose the location as C:/xampp/php/php. Step 3: Next popup will confirm the proxy settings. So

Comments
  • How can i ignore private repository. Some package require private repo.
  • Awesome. It's useful when php cli is not reflecting a version change yet.
  • --ignore-platform-reqs is not for all commands available, as your answer implies.
  • First I would like to know how to bypass the PHP requirement.
  • You can't and you won't as the code won't work in a lower php version
  • It will. Just the CI server got the low PHP version. The server which contains the facebook SDK runs on PHP 5.4. It is just about the ci server, which packs everything to a nice deployable zip file.
  • Although PHP 5.3 is no longer maintained by the core PHP developers, some flavours of Linux still support it and will do for a while yet. Ubuntu 12.04 LTS ships with 5.3 and is supported until April 2017 (wiki.ubuntu.com/LTS). Moving to 14.04 is the best upgrade path but there are breaking changes which require an amount of work to fix (Apache 2.4, php-fpm etc). Hence a lot of the internet still using 5.3.x.
  • true unfortunately 99% of packages even the well supported ones don't have the proper requirements. It's more a indicator of what the developer is using than anything else.