Home » Php » php – Composer dependency error acquiring microsoft/windowsazure package

php – Composer dependency error acquiring microsoft/windowsazure package

Posted by: admin July 12, 2020 Leave a comment

Questions:

I’m having difficulty getting the PHP client libraries package for Windows Azure via Composer. The problem would appear to be around Pear dependencies the package has.

The contents of the composer.json file:

  {
      "require": {
          "microsoft/windowsazure": "dev-dev"
      },
      "repositories": [
          {
              "type": "pear",
              "url": "http://pear.php.net"
          }
      ]
  }

The output following running “composer update” reads:

Your requirements could not be resolved to an installable set of packages.

Problem 1
- Installation request for microsoft/windowsazure dev-dev -> satisfiable by microsoft/windowsazure[dev-dev].
- microsoft/windowsazure dev-dev requires pear-pear/http_request2 * -> no matching package found.

I’ve never experienced any difficulty getting this package in the past. I can provide more verbose logs on request.

How to&Answers:

I recall seeing a few issues raised due to changes in how replaces works in regards to pear bridging.

This issue needs to be fixed upstream to have pear-pear/* replaced with pear-pear.php.net/*, but as a workaround in your root composer.json you can explicitly require the dependencies in order to have them discovered by the solver.

{
    "require": {
        "microsoft/windowsazure": "dev-dev",
        "pear-pear.php.net/http_request2": "*",
        "pear-pear.php.net/mail_mime": "*",
        "pear-pear.php.net/mail_mimedecode": "*"
    },
    "repositories": [
        {
            "type": "pear",
            "url": "http://pear.php.net"
        }
    ]
}

The above composer.json should work in the latest and future versions of composer. Tested with Composer version aa9c257f0efd1a54c93ba95282821a497bc15d75 2014-03-09 15:09:15

Answer:

This is a composer bug, I fixed it by using an older version of composer. Your composer.json is fine. The version I used was:

Composer version 42c496752ab6ec6c45b185b70c8c39220da01b1c

https://github.com/composer/composer/archive/42c496752ab6ec6c45b185b70c8c39220da01b1c.zip