Composer依赖性不适用于PHPDOX

时间:2014-09-01 19:37:25

标签: php composer-php packagist

我正在尝试通过composer安装phpdox。

"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"
}

产生以下内容:

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

然而,在packagist网站上,它说phpdox有一个依赖nikic/php-parser: >=1.0.0,它不存在。

我该如何解决?

1 个答案:

答案 0 :(得分:1)

nikic/php-parser仅被标记为测试版1.0,而非稳定版。

theseer/phpdox确实需要1.0.0版本,但它已在其自己的minimum-stability:dev中设置了prefer-stable:truecomposer.json。这些设置只能在根composer.json中定义。

两种解决方法:

  1. 自己需要该软件包所需的测试版:composer require nikic/php-parser:~1.0@beta会这样做。
  2. 同时将最小稳定性设置设置为至少“beta”,并添加prefer-stable标志,以避免让所有软件包处于稳定状态。
  3. 阅读安装说明我认为您不应该直接通过Composer来使用此工具。我看不出有什么不这样做的原因,但这可能没有预料到。所以可选步骤3:在Github上打开一张票,以解决这个问题。