Thomas Decaux
Thomas Decaux

Reputation: 22661

Install one package without checking all requirements with composer

I have a composer.json like this:

{
"require": {
    "symfony/yaml" : "dev-master",
    "symfony/console" : "dev-master",
    "ebuildy/ebuildy" : "dev-master",
    "keboola/php-encryption": "dev-master",
    "pear-pear.php.net/mail_mime" : "*",
    "pear-pear.php.net/http_request2" : "*",
    "pear-pear.php.net/mail_mimedecode" : "*",
    "microsoft/windowsazure": "*",
    "rollbar/rollbar": "dev-master",
    "facebook/php-sdk-v4" : "4.0.*",
    "happyr/linkedin-api-client": "dev-master",
    "zircote/swagger-php" : "dev-master",
    "google/apiclient" : "dev-master"
},
    "autoload": {
        "psr-0": {
           "bizlunch": "src/"
        }
    },
    "minimum-stability": "dev"
}

Just added "google/apiclient", I want to install this new package without checking other packages requirements (because on my dev machine "keboola/php-encryption" complains about crypt ext missing and other stuff).

What is the right command? Tried already update PACKAGE, but this fails:

$root: php composer.phar update google/apiclient       
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
- keboola/php-encryption dev-master requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.

Upvotes: 1

Views: 1924

Answers (3)

Tomáš Fejfar
Tomáš Fejfar

Reputation: 11217

If you want to ignore the specifics of your local system, you can use --ignore-platform-reqs flag. Keep in mind that it may result in unusable lockfile in production.

Let's show it on imaginary scenario:

  • you don't have ext-crypt locally and neither in production.
  • there is package cryptX that
    • in cryptX:1.0 uses lib-crypt-polyfill (that does what ext-crypt does using PHP code)
    • but in cryptX:2.0 they changed the dependency to ext-crypt.

Now if you were to install it normally, you'd get version 1 (which is the only one meeting the dependencies). But with --ignore-platform-reqs it just works as if whatever it wants is available in your system. So it happily installs version 2, which does not work on you machine, but what's more it won't work on you production server neither.

Upvotes: 5

Maybe PHP extension mcrypt isn't installed on your machine. See how to install it here http://php.net/manual/en/mcrypt.setup.php

In an Ubuntu machine run :

apt-get install php5-mcrypt

php5enmod mcrypt

service apache2 restart

Upvotes: 0

Mark Baker
Mark Baker

Reputation: 212412

As easy as

php composer.phar update google/apiclient 

or you can specify several individual packages as

php composer.phar update google/apiclient zircote/swagger-php rollbar/rollbar

Upvotes: 0

Related Questions