phpDocumentor

         Rimpei Ogawa




   2009/6/29 -
• “Writing good documentation is essential
    to the success of any software project.”
    http://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/
    tutorial_phpDocumentor.pkg.html


•                OSS
•
    ➡

•
    ➡   API
phpDocumentor
phpDocumentor
• Automatic Documentation System
phpDocumentor
• Automatic Documentation System
• for PHP code
phpDocumentor
• Automatic Documentation System
• for PHP code
• written in PHP
phpDocumentor
• Automatic Documentation System
• for PHP code
• written in PHP
PHP        PHP
API
• PEAR API Documentation
http://pear.php.net/package/Auth/docs/latest/
• Zend Framework
http://framework.zend.com/apidoc/core/
• symfony
http://www.symfony-project.org/api/1_2/
•             PEAR

    ‣ pear install PhpDocumentor
•
    •

    • DocBlock
DocBlock
DocBlock
/**
DocBlock
/**
 * Short description
 *
DocBlock
/**
 * Short description
 *
 * Long description. This is an sample function
 * to show the DocBlock format.
 *
 * 2nd paragraph of long description.
 *
DocBlock
/**
 * Short description
 *
 * Long description. This is an sample function
 * to show the DocBlock format.
 *
 * 2nd paragraph of long description.
 *
 * @tag1
 * @tag2
 */
function example()
Short Description
• DocBlock
•
•3                   1


  Long Description
Long Description
•
            SGML

•

•         <p>
Long Description
• HTML
  • b, code, br, i, kbd, li, ol, p, pre, samp, ul, var
•             Short description
Long Description
•
/**
 * -   unordered item A
 * -   unordered item B
 *
 * 1   ordered item A
 * 2   ordered item B
 */
Long Description
•
    • <ul>   “-”, “+”, “#”, “o”

    • <ol>   “1”, “1.”

    •                             NG

    •
Tags
•@
 • @author @package @param @version
       30

• {@tagname}
@author
@author authorname <name@example.com>


•
•
@license
@license URL name of license


•                  URL

•
@license http://opensource.org/licenses/gpl-
license.php GNU Public License
@deprecated
@deprecated version/info string


•

•
@deprecated deprecated since version 2.0

@deprecated
@package
•

•              DocBlock
    @package
@subpackage
•

•   @package
@param
 @param datatype $paramname description


•
• Type Hinting                PHP

•
 @param int $num

 @param bool|string $foo a bool or string param
@return
@return datatype description


•
•                                 PHP

•
@return mixed

@return FooClass|false FooClass object or error
PHP


http://www.php.net/manual/ja/language.types.php
PHP5
•

    • @abstract
    • @access {private|protected|public}
    • @final
    • @static
DocBlock Template
•


•          DocBlock Template
DocBlock Template
/**#@+
 * @access private
 * @var string
 */
var $_var1 = ‘Hello’;
var $_var2 = ‘World’;
...
var $_varN;
/**#@-*/

//
var $varX = array();
• phpdoc
•

 • HTML
   <meta>   OK
• -d :

• -t :
• -o :
•

    •   HTML -                Smarty

    •   CHM - Windows Help

    •   PDF - Adobe Acrobat

    •   XML:DocBook -
Web


http://www.phpdoc.org/
20090629 Using phpDocumentor

20090629 Using phpDocumentor