一、准备
说明:windows 执行一下命令需要已管理员身份运行cmd,linux 则需要注意相应的权限。
下载 pear http://pear.php.net/go-pear.phar
将 go-pear.phar 放到 PHP 目录下
执行安装命令:
php go-pear.phar
(如果已安装pear可以略过)
二、安装其他包
pear install http://download.pear.php.net/package/Image_GraphViz-1.3.0.tgz
pear install XML_Parser
pear install XML_Beautifier
查看已安装
pear list
下载和安装graphviz
linux 安装方式:
yum install 'graphviz*'
windows安装方式
http://www.graphviz.org/Download_windows.php 点击下载即可
但是要把graphviz安装成功,还是需要一点注意:
安装时候将路径设为无空格的,比如d:/graphviz就可以,然后手动把bin目录加入系统环
境变量path中
在cmd窗口下输入dot后如果不报错说明graphviz才算真的安装完全。
三、下载 http://www.phpdoc.org/phpDocumentor.phar
将phpDocumentor.phar 放到 PHP 目录下
执行
php phpDocumentor.phar -d /test/api -t docs/api
则可将test/api 目录的程序转成相应的文档
phpDocumentor文档说明:
http://www.phpdoc.org/docs/latest/getting-started/installing.html
四、附上一些参数说明
--target (-t) Path where to store the generated output
--cache-folder Path where to store the cache files
--filename (-f) Comma-separated list of files to parse. The wildcards ? and * are supported (multiple values allowed)
--directory (-d) Comma-separated list of directories to (recursively) parse (multiple values allowed)
--encoding encoding to be used to interpret source files with
--extensions (-e) Comma-separated list of extensions to parse, defaults to php, php3 and phtml (multiple values allowed)
--ignore (-i) Comma-separated list of file(s) and directories (relative to the source-code directory) that will be ignored. Wildcards * and ? are supported (multiple values allowed)
--ignore-tags Comma-separated list of tags that will be ignored, defaults to none. package, subpackage and ignore may not be ignored. (multiple values allowed)
--hidden Use this option to tell phpDocumentor to parse files and directories that begin with a period (.), by default these are ignored
--ignore-symlinks Ignore symlinks to other files or directories, default is on
--markers (-m) Comma-separated list of markers/tags to filter (multiple values allowed)
--title Sets the title for this project; default is the phpDocumentor logo
--force Forces a full build of the documentation, does not increment existing documentation
--validate Validates every processed file using PHP Lint, costs a lot of performance
--visibility Specifies the parse visibility that should be displayed in the documentation (comma separated e.g. "public,protected") (multiple values allowed)
--defaultpackagename Name to use for the default package. (default: "Default")
--sourcecode Whether to include syntax highlighted source code
--progressbar (-p) Whether to show a progress bar; will automatically quiet logging to stdout
--template Name of the template to use (optional) (multiple values allowed)
--parseprivate Whether to parse DocBlocks marked with @internal tag
--log Log file to write to
--help (-h) Display this help message
--quiet (-q) Do not output any message
--verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
--version (-V) Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
--no-interaction (-n) Do not ask any interactive question
--config (-c) Location of a custom configuration file