Installation
There are three, recommended, ways to start using phpDocumentor:
- Pull our pre-built docker image (recommended).
- Use Phive to install phpDocumentor as a dependency in your project.
- Download the PHAR file and place it in the location of your liking.
Which one you use depends on whether you want to use Docker or not, or include phpDocumentor in your project's setup.
System Requirements
If you are using the official Docker container, or Github Action, you do not need to worry about this and can directly skip to the chapter Stand-alone, using Docker.
phpDocumentor has several dependencies on other software packages. Please make sure that you have these available before installing phpDocumentor.
Stand-alone, using Docker
Although not an actual installation method; the easiest method to use phpDocumentor, if you have Docker installed, is to use our Docker image. The Docker image comes with all dependencies pre-installed so that you do not have to install these locally.
To run phpDocumentor using docker, the following should suffice:
$ docker run --rm -v "$(pwd):/data" "phpdoc/phpdoc:3"
As a convenience, you can alias this command so that you can use it from any folder easily:
$ alias phpdoc="docker run --rm -v $(pwd):/data phpdoc/phpdoc:3"
After doing that, you can simply call phpdoc
from any location. This may also help with following the examples
in this documentation as we assume you have a command called phpdoc
available globally.
As a dependency, using Phive
If phive is globally installed, you can run the following command:
$ phive install phpDocumentor
Once you run the command, phpDocumentor will be installed and it can be executed directly.
For more information about Phive have a look at the Phive website.
Stand-alone, downloading a PHAR
You can download the latest PHAR file from https://phpdoc.org/phpDocumentor.phar or a specific version from https://github.com/phpDocumentor/phpDocumentor/releases.
The phar file can be used by invoking PHP directly and providing the phar file as a parameter:
$ php phpDocumentor.phar run -d . -t docs/api
or, on Mac and Linux, you can mark it as executable and move it to your bin folder:
$ chmod +x phpDocumentor.phar
$ mv phpDocumentor.phar /usr/local/bin/phpDocumentor
After that you can run it globally:
$ phpDocumentor run -d . -t docs/api
And next
- What is a DocBlock? - how to quickly start using phpDocumentor.
- Configuration - advanced configuration options.