【问题标题】:Can't install phpDocumentor via Composer无法通过 Composer 安装 phpDocumentor
【发布时间】:2014-06-09 10:47:03
【问题描述】:

在 composer.json 我有

{
    "require":
    {
        "phpdocumentor/phpdocumentor": "*"
    }
}

之所以存在,是因为我正在尝试使用 ./composer.phar install 命令将 phpDocumentor 安装到一个隔离的文件夹中。但我得到的是

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
    - phpdocumentor/phpdocumentor v2.0.0 requires phpdocumentor/template-abstract ~1.2 -> satisfiable by phpdocumentor/template-abstract[1.2, 1.2.1].
    - phpdocumentor/phpdocumentor v2.0.1 requires phpdocumentor/template-abstract ~1.2 -> satisfiable by phpdocumentor/template-abstract[1.2, 1.2.1].
    - phpdocumentor/phpdocumentor v2.1.0 requires phpdocumentor/template-abstract ~1.2 -> satisfiable by phpdocumentor/template-abstract[1.2, 1.2.1].
    - phpdocumentor/phpdocumentor v2.2.0 requires phpdocumentor/template-abstract ~1.2 -> satisfiable by phpdocumentor/template-abstract[1.2, 1.2.1].
    - phpdocumentor/phpdocumentor v2.3.2 requires phpdocumentor/template-abstract ~1.2 -> satisfiable by phpdocumentor/template-abstract[1.2, 1.2.1].
    - phpdocumentor/phpdocumentor v2.4.0 requires phpdocumentor/template-abstract ~1.2 -> satisfiable by phpdocumentor/template-abstract[1.2, 1.2.1].
    - phpdocumentor/phpdocumentor v2.3.1 requires dompdf/dompdf dev-master@dev -> no matching package found.
    - phpdocumentor/phpdocumentor v2.3.0 requires dompdf/dompdf dev-master@dev -> no matching package found.
    - phpdocumentor/template-abstract 1.2.1 requires ext-xsl * -> the requested PHP extension xsl is missing from your system.
    - phpdocumentor/template-abstract 1.2 requires ext-xsl * -> the requested PHP extension xsl is missing from your system.
    - Installation request for phpdocumentor/phpdocumentor * -> satisfiable by phpdocumentor/phpdocumentor[v2.0.0, v2.0.1, v2.1.0, v2.2.0, v2.3.0, v2.3.1, v2.3.2, v2.4.0].

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.

【问题讨论】:

    标签: php composer-php documentation-generation package-managers


    【解决方案1】:

    试试 sudo apt-get install php5-xsl

    【讨论】:

    • 这对我有用,让我可以继续使用 Composer 来管理包,所以我没有将这个包与我的所有其他包分开管理:)
    【解决方案2】:

    错误消息表明您在 PHP 设置中缺少 XSL 扩展。您可以查看http://www.php.net/manual/en/xsl.installation.php 了解有关安装该扩展程序的更多信息。

    请注意,默认模板不需要 XSL 扩展;您还可以选择使用 PHAR 可执行文件或可下载的存档。这些可以从https://github.com/phpDocumentor/phpDocumentor2/releases/latest 下载。这两个不检查 XSL 扩展,因此可以安全使用。

    【讨论】:

    • 我需要 phpDoc 的源代码对其进行一些大胆的编辑。谢谢。
    【解决方案3】:

    您可以轻松启用 XSL 扩展(因为它默认包含在 php 5 中)。

    找到 php.ini 文件并启用(取消注释)

    extension=php_xsl.dll

    (在 WAMP 上;点击 wamp 图标 -> PHP -> PHP Extensions -> php_xsl)

    请不要忘记在 PHP CLI 使用的 php.ini 文件中启用扩展 (see here),因为这是 composer 在命令行上运行时使用的一个。 p>

    供参考(来自上面的链接):

    /etc/php5/cli/php.ini 用于 CLI PHP 程序,您可以通过 在终端上运行php。

    /etc/php5/cgi/php.ini 用于 php-cgi 系统,它不是 专门用于此设置。

    /etc/php5/apache2/php.ini 是 Apache 使用的 PHP 插件。这 是您需要编辑以将更改应用于您的 Apache 设置。

    之后重启服务器可能会很方便。

    PS:您可以使用以下方式验证扩展程序的可用性:

    作曲家表演-p

    祝你好运。

    【讨论】:

      【解决方案4】:

      只是想更新当前(PHP 7.4)在 php.ini 文件中取消注释的行是:

      ;extension=xsl

      【讨论】:

        【解决方案5】:

        你不应该作曲家来安装 PhpDocumentor!

        为什么?在主页上,Official PhpDocumentator website,您可以找到:

        但是等一下?作曲家呢?

        啊,你发现了我们的秘密。有一个 phpDocumentor 作曲家 可以用来安装 phpDocumentor 的软件包。

        但是:phpDocumentor 是一个复杂的应用程序,它的库是 用于无数其他库和应用程序(我们的 2 个库 每个下载量超过 1.5 亿次);这意味着 我们的依赖项之一与您的依赖项之间发生冲突的可能性是 高的。当我说高时,它真的很高。

        因此,由于上述原因:我们不认可也不积极支持 使用 Composer 安装 phpDocumentor。

        基于此,也许最好创建一个脚本来安装它。这里只是一个例子:

        wget https://phpdoc.org/phpDocumentor.phar
        chmod 0755 phpDocumentor.phar
        sudo mv phpDocumentor.phar /usr/local/bin/phpdoc
        sudo apt install -y graphviz
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2016-05-11
          • 2020-05-08
          • 1970-01-01
          • 1970-01-01
          • 2023-01-30
          • 2016-04-09
          • 2016-07-16
          • 2019-10-21
          相关资源
          最近更新 更多