phpnamespacesphpdocdocblocksphpdocumentor2

Using @package instead of namespace in PhpDocumentor 2


I have a large code library for which I am trying to generate hierarchical documentation. The project does not use namespaces but uses @package instead.

I just tried generating docs as a test from the following file with phpDocumentor2:

<?php
/**
 * This is a file
 * @package JustAn\Example
 **/

 /**
 * Something class
 **/
 class Something{
    function try_this(){

    }
 }

Though according to the docs @package JustAn\Example should be the equivalent of namespace JustAn\Example, I found this not to be the case.

When I use namespaces the resulting documentation is like this:

namespace version

When I use the @package notation the result looks like this (even though it recognizes the package notation - this is shown on the full details page of the class):

package notation version

I am looking for a way to get the hierarchical result without having to rewrite the code to use 'real' namespaces.


Solution

  • The problem is that the default "clean" template does not support this feature. Other templates (like "responsive" for example) do. You can use the --template="responsive" flag to change the default template used.