phptwigphpdocphpdocumentor2

Phpdocumentor looks for custom templates in vendor directory


I need to create custom template for PhpDocumentor. The problem is that paths defined in the template.xml, even when specified as absolute ones, are not resolved correctly. PhpDocumentor looks for them in the vendor directory.

<template>
    <author>Code Mine</author>
    <email>office@code-mine.com</email>
    <description>Template for Confluence API</description>
    <version>1.0.0</version>
    <transformations>
        <transformation writer="twig" source="./index.html.twig" artifact="index.html"/>
        <transformation query="indexes.namespaces" writer="twig" source="./namespace.html.twig" />
        <transformation query="indexes.classes" writer="twig" source="./class.html.twig" />
    </transformations>
</template>

Despite fact that twig templates are located in path to which xml refers, I'm getting error that files don't exist.

EDIT:

I have also tried with setting up all configuration details in phpdoc.xml in hope that paths will be considered relative to configuration file but with no luck.


Solution

  • If you specify a custom template with --template="..." it will (for some strange reason) copy that entire template into the vendor folder together with the original templates, and therefore the path structure in template.xml needs to remain the same. You only need to change eg. templates/clean/ to templates/yourtemplatename/.

    I have an issue with caching though. I can't get it to reread my template every time. It has cached it somewhere and I can't for the life of me figure out where. Documentation is really bad and source is worse.

    Update: Finally figured out that it cached my template in the temp folder of my computer. For Windows eg.: c:\Users\<username>\AppData\Local\Temp\phpdoc-twig-cache\. So I just delete that entire folder.