0

I am trying to install phpdox through composer.

"require": {
    "phploc/phploc": "2.0.6",
    "phpunit/phpunit": "4.2.4",
    "pdepend/pdepend": "2.0.0",
    "phpmd/phpmd": "2.0.0",
    "squizlabs/php_codesniffer": "2.0.0a2",
    "sebastian/phpcpd": "2.0.*@dev",
    "theseer/phpdox": "0.6.6.1"
}

Which produces the following:

Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

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
  - Installation request for theseer/phpdox 0.6.6.1 -> satisfiable by theseer/phpdox[0.6.6.1].
  - theseer/phpdox 0.6.6.1 requires nikic/php-parser >=1.0.0 -> no matching package found.

Potential causes:
  - A typo in the package name
  - The package is not available in a stable-enough version according to your minimum-stability setting

However, on the packagist website it says that phpdox has a dependency nikic/php-parser: >=1.0.0 which does not exist.

How do I resolve that?

Maxcot
  • 1,513
  • 3
  • 23
  • 51

1 Answers1

1

The package nikic/php-parser has only been tagged as a beta version 1.0, not a stable release.

theseer/phpdox does require that 1.0.0 version, however it has set minimum-stability:dev and prefer-stable:true in it's own composer.json. These settings can only be defined in the root composer.json.

Two ways to fix it:

  1. Require the needed beta version of that package yourself: composer require nikic/php-parser:~1.0@beta would do it.
  2. Also set the settings for minimum stability to at least "beta" and add the prefer-stable flag to avoid getting ALL packages in beta stability.

Reading the installation instructions I get the idea that you are not supposed to require this tool directly via Composer. I can't see a reason why not to do it, but this probably hasn't been anticipated. So optional step 3: Open a ticket on Github to get this issue fixed.

Sven
  • 69,403
  • 10
  • 107
  • 109
  • The other alternative that occured to me was to just go back through previous versions of phpdox to find one whose dependancy DOES exist. Although that may raise other issues. (Being new to these php tools, there may be another learning curve lurking :) ) – Maxcot Sep 01 '14 at 20:30
  • When you say "...you are not supposed to require this tool directly via Composer..." I presume you are referring to php-parser? – Maxcot Sep 01 '14 at 20:31
  • No, I was referring to PHPDox itself. There is [no installation procedure described using Composer](https://github.com/theseer/phpdox/blob/master/README.markdown). The preferred way is to download the complete .phar file. Alternatively: Clone the repo and run `composer install`. Not mentioned: Include the package via Composer in your own project. And this probably makes sense, because pulling several development tools, all with their own tree of dependencies, at some point might have an unpleasant feedback on your own software: You are forced to use the versions your dev tools also use. – Sven Sep 02 '14 at 00:24
  • And yet Packagist has composer versions available for install going back to 2013...? – Maxcot Sep 02 '14 at 00:28
  • Composer is around since 2011, with the first tagged alpha release in March 2012. Packagist only scans repositories, and if a tag or branch has a `composer.json` available, it will get indexed. If needed, there is nobody preventing a project to re-tag their releases in the repository adding this file, so Packagist can index and provide older releases. – Sven Sep 02 '14 at 00:33