maanantai 22. lokakuuta 2012

DocumentorBundle for your Symfony2 project's documentation needs

After I acquired some inspiration from Mike Van Riel's talk about phpDocumentor2 at PHPNW12 conference, I decided to make it easier for developers to generate their PHP documentation in Symfony2 projects.

https://github.com/artur-gajewski/DocumentorBundle

Once you add DocumentorBundle to your composer.json file and update the vendors with it, you need to activate the module in the AppKernel.php file by adding the following line to the bundles array:

$bundles[] = new \Aga\DocumentorBundle\DocumentorBundle();

Now you only need to run a command in console:

app/console documentation:create

DocumentorBundle will now generate php documentation in /web/bundles/documentor folder, which you can access with your browser by going to that URI.

The bundle generates documentation only from the the bundles installed under src/ folder. What I like about the phpDocumentor2 is the way it tells you what is missing from your php classes; DocBlocks for class, functions and variables. This way you can run the command and fix the documentation until you have no error messages listed.

I also like how visually pleasant the outcome of the phpDocumentor2 is. It is nicely styles and categorized in click-to-see fashion. You can hide/unhide different variable and function types and also can see all @todo statements across the bundles.

Little ending note about DocumentorBundle, PhpDocumentor2 is required. Once they get phpDocumentor2 installable via Composer, this will be not q requirement as I will make it a dependency for this bundle.

2 kommenttia:

  1. I see phpDocumentor2 on Packagist already: https://packagist.org/packages/phpdocumentor/phpdocumentor

    Your bundle should be able to require it already, no?

    VastaaPoista