Can't install phpDocumentor via Composer
Asked Answered
P

5

7

In composer.json I've got

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

It's what is there because I'm trying to install phpDocumentor into an isolated folder with ./composer.phar install command. But what I'm getting is

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.
Policewoman answered 24/4, 2014 at 8:44 Comment(0)
G
8

The error message indicates that you are missing the XSL extension in your PHP setup. You can see http://www.php.net/manual/en/xsl.installation.php for more information on installing that extension.

Please note that the XSL extension is not necessary for the default template; you can also choose to use the PHAR executable or the downloadable archive. These can be downloaded from https://github.com/phpDocumentor/phpDocumentor2/releases/latest. These two do not check for the XSL extension and can thus be safely used.

Garamond answered 24/4, 2014 at 9:8 Comment(1)
I needed the phpDoc's source to make some audacious edits to it. Thanks.Policewoman
Z
9

Try sudo apt-get install php5-xsl

Zarla answered 24/6, 2014 at 20:29 Comment(1)
This worked for me and allowed me to continue using Composer to manage the package, so I didn't have this one package managed separately from all my others :)Brash
G
8

The error message indicates that you are missing the XSL extension in your PHP setup. You can see http://www.php.net/manual/en/xsl.installation.php for more information on installing that extension.

Please note that the XSL extension is not necessary for the default template; you can also choose to use the PHAR executable or the downloadable archive. These can be downloaded from https://github.com/phpDocumentor/phpDocumentor2/releases/latest. These two do not check for the XSL extension and can thus be safely used.

Garamond answered 24/4, 2014 at 9:8 Comment(1)
I needed the phpDoc's source to make some audacious edits to it. Thanks.Policewoman
C
1

You can easily enable the XSL extension (since its included by default in php 5).

Locate the php.ini file and enable (uncomment)

extension=php_xsl.dll

(on WAMP; click on the wamp icon -> PHP -> PHP Extensions -> php_xsl)

Please DON'T FORGET to also enable the extension in the php.ini file used by PHP CLI (see here) as this is the one composer uses when run on command line.

For Reference (from above link):

/etc/php5/cli/php.ini is for the CLI PHP program, which you found by running php on the terminal.

/etc/php5/cgi/php.ini is for the php-cgi system which isn't specifically used in this setup.

/etc/php5/apache2/php.ini is for the PHP plugin used by Apache. This is the one you need to edit for changes to be applied for your Apache setup.

Might be handy to restart the server afterwords.

PS: You may verify the extension's availability using:

composer show -p

Good Luck.

Criseldacrisey answered 28/4, 2014 at 4:49 Comment(0)
M
0

Just wanted to update that currently(PHP 7.4) the line to uncomment in php.ini file is:

;extension=xsl

Manara answered 25/4, 2021 at 8:51 Comment(0)
G
0

You shouldn't composer to install the PhpDocumentor!

Why? On the homepage, of the Official PhpDocumentator website, you can found:

But wait? What about Composer?

Ah, you discovered our secret. There is a phpDocumentor composer package that you could use to install phpDocumentor.

However: phpDocumentor is a complex application, and its libraries are used in countless other libraries and applications (2 of our libraries have more than 150 million downloads each); and this means that the chances for a conflict between one of our dependencies and yours is high. And when I say high, it is really high.

So, because of the above: we do not endorse nor actively support installing phpDocumentor using Composer.

Based on this, maybe is better to create a script to install it. Here is just a example:

wget https://phpdoc.org/phpDocumentor.phar
chmod 0755 phpDocumentor.phar
sudo mv phpDocumentor.phar /usr/local/bin/phpdoc
sudo apt install -y graphviz
Gymnasiast answered 27/4, 2021 at 23:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.