phpDocumentor on Windows — but please, you knew that already

So the below description will give you a step-by-step to run phpDocumentor (which replaces phpDoc):

Get it at www.phpdoc.org or install it via PEAR (much easier – 2MB download or so).

For Windows machines:

  • go-pear.bat (if you haven’t already — find it if you don’t know where it is) and pear install --alldeps phpdocumentor
  • Do a search for PEAR_ENV.reg on your machine.
  • Execute it.
  • Make sure you’ve got the Environment Variables set to point to include the PHP bin directory (
    set PATH=%PATH%;c:\path\to\php ) OR

    1. From the desktop, right-click My Computer and click properties.
    2. In the System Properties window, click on the Advanced tab.
    3. In the Advanced section, click the Environment Variables button.
    4. Finally, in the Environment Variables window, highlight the path variable in the Systems Variable section and click edit. Add or modify the path lines with the paths you wish the computer to access. Each different directory is separated with a semicolon as shown below.
    5. In Vista:
      • Open the the Control Panel, select the System and Maintenance link, and select the System link. Or, press the Windows key and the Pause / Break key at the same time.
      • Select the Advanced System settings link.
  • You can now call php and pear commands from the command line (you many need to restart for the changes to come into effect).
  • Verify by typing phpdoc -h
  • phpdoc -d "c:\projectDir" -o HTML:default:default -t "c:\projectDir\docs"
  • for PDF files, replace the output parameter (-o): -o PDF:default:default
  • Formatting in smarty (like PHP website etc): -o HTML:smarty:default
  • -t = target directory of generated documents
    -d = source directory of files to check
    -o output format as above.
    Tags to use in docblocks:

    * @abstract
    * @access       public or private
    * @author       author name <author@email>
    * @copyright    name date
    * @deprecated   description
    * @deprec       alias for deprecated
    * @example      /path/to/example
    * @exception    Javadoc-compatible, use as needed
    * @global       type $globalvarname
    or
    * @global       type description of global variable usage in a function
    * @ignore
    * @internal     private information for advanced developers only
    * @param        type [$varname] description
    * @return       type description
    * @link         URL
    * @name         procpagealias
    or
    * @name         $globalvaralias
    * @magic        phpdoc.de compatibility
    * @package      package name
    * @see          name of another element that can be documented,
    *               produces a link to it in the documentation
    * @since        a version or a date
    * @static
    * @staticvar    type description of static variable usage in a function
    * @subpackage   sub package name, groupings inside of a project
    * @throws       Javadoc-compatible, use as needed
    * @todo         phpdoc.de compatibility
    * @var          type a data type for a class variable
    * @version      version

    Basic format of a docBlock:


    /**
    * return the magic number
    *
    * Using the form magic divided by 83 plus 42 (the meaning of life),
    * the magic number is returned. If the number is not divisble by 7,
    * it is the next prime after today's date
    in the format
    * YYYYDDMMhhmmss that ends in 9
    */

    But please — you did know this already…

5 comments on «phpDocumentor on Windows — but please, you knew that already»

  1. just2pick1 says:

    thank you, installation was easy.
    now gotta read about the how document my code!

  2. Julia says:

    Thank God you wrote this, you saved me :) i think this was the key of the success: “(you many need to restart for the changes to come into effect).” Thanks

  3. Tjorriemorrie says:

    What’s the -o option to enable javascript enhancement?

  4. Sven Welzel says:

    Legal -o values include:

    HTML:frames:default
    HTML:frames:l0l33t
    HTML:frames:phpdoc.de
    HTML:frames:phphtmllib
    HTML:frames:earthli
    HTML:frames:DOM/default
    HTML:frames:DOM/l0l33t
    HTML:frames:DOM/phpdoc.de
    HTML:frames:DOM/phphtmllib
    HTML:frames:DOM/earthli
    HTML:Smarty:default
    HTML:Smarty:PHP
    HTML:Smarty:HandS
    PDF:default:default
    CHM:default:default
    XML:DocBook/peardoc2:default

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>