mac osx brew 安装的php默认情况是没有安装pear的,需要手工安装,方法如下:
1.转到php bin目录
wget https://pear.php.net/go-pear.phar
php go-pear.phar
安装文档 http://pear.php.net/manual/en/installation.getting.php
Pear仓库还是有很多有趣的共用组件的,参考下 http://pear.php.net/packages.php
2.安装phpdocument
pear channel-discover pear.phpdoc.org
pear install phpdoc/phpDocumentor
brew install GraphViz
https://github.com/phpDocumentor/phpDocumentor2
3.使用phpdocument生成文档
phpdoc -d projects_source_dir -t /save_project_document_to/
phpdocument更多使用说明,参考官网 https://www.phpdoc.org/docs/latest/index.html
例子:
/**
* Counts the number of items in the provided array.
*
* @todo add an array parameter to count
* @link http://example.com/my/bar Documentation of Foo.
* @see http://example.com/my/bar Documentation of Foo.
* @see MyClass::$items For the property whose items are counted.
* @see MyClass::setItems() To set the items for this collection.
*
* @return string|null The label's text or null if none provided.
*/
function getLabel()
{
<...>
}