Servage Magazine

Information about YOUR hosting company – where we give you a clear picture of what we think and do!

New phpDocumentor makes even nicer docs for your code

Friday, September 7th, 2012 by Servage

We have previously described PhpDocumentor, a tool which enables you go convert inline documentation to great and nice looking docs for your web project. PhpDocumentor is now available in a newer version, which is not only better and faster and compiling your docs, but also provides a nicer documentation layout.

It’s a common problem amongh developers that insufficiently or no documentation of code causes problems, delays, misunderstandings. Even code you wrote yourself could look really strange after a while, when you no longer remember what’s exactly going on. At this point a good documentation could help you save time and nerves.

PhpDocumentor is a good script that generates documentation for your code based on inline comments in your script files. It can generate various output formats, has different themes, and is very customizable. It only requires that you actually commend your code.

You can read how to comment your code easily in the PhpDocumentor manual. There are a few useful samples and general descriptions of all tags etc. you can use in your code.

The actual usage of PhpDocumentor is really simple. You just need to download the package, place it somewhere accessible via a browser, and you get a nice webinterface to create your documentation. Remember that PhpDocumentor needs proper read/write permissions to your project files and the documentation destination folder, where you docs are stored. It’s all described in the PhpDocumentor manuel, and you should be able to have a finished documentation of your project within just a few minutes (plus the time to actually write the needed comments). As time passes you will hopefully learn to comment your code as you write it, so the generation of the documentation becomes a continous, easy and natural part of your development. I’m sure this will ease your work!

Sample commented class

 * My class
 * Provides my own functions for my own purpose. Really cool!
 * @package mystuff
class MyClass {
     * @var string $myvar The most important variable.
    var $secondvar = 42;

     * Function that does something.
     * @param string $what to do.
     * @return boolean true if it could be done, false if no.
    function doSomething($what) {
      return true;
New phpDocumentor makes even nicer docs for your code, 4.0 out of 5 based on 3 ratings
Categories: Tips & Tricks


You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

No comments yet (leave a comment)

You are welcome to initiate a conversation about this blog entry.

Leave a comment

You must be logged in to post a comment.