Michel Lecomte
Michel Lecomte

Reputation: 405

PHPDocumentor template

Can someone tell me :

  1. Where to download new templates
  2. how to install a template to override the default.
  3. Where is the default template folder ?

Thk.

Upvotes: 5

Views: 5554

Answers (3)

Toby Allen
Toby Allen

Reputation: 11213

I downloaded the phpDocumentor.phar and was also somewhat confused as to the available templates. This is from the source on github at version 2.8.3

  • abstract
  • clean
  • new-black
  • old-ocean
  • responsive-twig
  • responsive
  • xml
  • zend

For phpDocumentor 3, available templates listed on github are:

  • clean
  • default
  • responsive-twig
  • xml

Upvotes: 4

nelson6e65
nelson6e65

Reputation: 1101

Where to download new templates

There is not an "official" page for this; you have to search on the internet.

However, if you'd want to try VuePress, you can use a compatible template nelson6e65/phpdoc-vuepress I created (see a demo).


How to install a template to override the default

There are many ways of installing a template: manual download, using Composer, etc...

The important thing is where is installed the "new" template and then, like stated in documentation, you can use an external template by passing ---template with the location of your template (the directory where template.xml is):

$ phpdoc -d "./src" -t "./docs/api" --template="data/templates/my_template"

For example, for the template I linked before, you can achieve this by running:

# Installing
$ composer require --dev nelson6e65/phpdoc-vuepress
# Using
$ phpdoc -d=src/ -t=docs/api/ --template="vendor/nelson6e65/phpdoc-vuepress/data/templates/vuepress"

In this case, this template.xml file is installed in a relative path of your project: vendor/nelson6e65/phpdoc-vuepress/data/templates/vuepress/template.xml

Note: I am getting an error on using custom templates if I use the *.phar. So, you may need to use another distribution method of the phpdoc.


Where is the default templates folder

Depending on your installation method.

If you used a Composer install or downloaded the sources, the templates folder is relative to where is installed data/templates. For Composer, is located at:

vendor/phpdocumentor/phpdocumentor/data/templates/

For global install via composer, templates are located ad ~/.config/composer/vendor/phpdocumentor/phpdocumentor/data/templates


I hope this is useful for you and others. Regards! :)

Upvotes: 0

Michel Lecomte
Michel Lecomte

Reputation: 405

--template in the phpdoc cmd line or edit /usr/share/pear/phpDocumentor/data/templates/phpdoc.tpl.xml and change the line " with the template name to use as default.

Default template dir is usr/share/pear/phpDocumentor/data/templates

Upvotes: 1

Related Questions