2020年4月

使用phpDocumentor可以快速根据规范的注释生成一整套接口文档,是进行php开发十分便利的工具。 有时候我们会在自己的框架内引入别的库,这个时候一键生成文档会导致将库文件一起分析,不仅速度很慢同时也会导致生成的文档出现不必要的内容。

可以使用 -i,-ignore 设定屏蔽文件夹的参数 可以参考官方文档:

project:run

-i|–ignore[”...”]
Provide a comma-seeparated list of paths to skip when parsing.

在使用phpar命令进行生成的时候,需要注意使用 --igonre 或 -i

参考如下:

sudo php /Library/WebServer/Documents/phpDoc/phpDocumentor.phar  -d /Library/WebServer/Documents/appsite-new/server -t /Library/WebServer/Documents/docs/appsite-new/doc --ignore library/ custom/ demo.php

如果有多个目录,使用 and 进行分隔,单一文件使用完整文件名结尾,文件目录要以/结尾。

旧版本官方文档 using.command-line.ignore

-i, --ignore
Use the -i option to exclude files and directories from parsing. The -i option recognizes the * and ? wildcards, like -f does. In addition, it is possible to ignore a subdirectory of any directory using "dirname/".

phpdoc -i tests/ will ignore /path/to/here/tests/* and /path/tests/*

phpdoc -i *.inc will ignore all .inc files

phpdoc -i *path/to/* will ignore /path/path/to/my/* as well as /path/to/*

phpdoc -i *test* will ignore /path/tests/* and /path/here/my_test.php

Since v1.3.2, the value or pattern you provide will be case-sensitive (OS permitting, anyway), and will be applied relative to the top-level directory in the -d argument.

phpdoc -i CVS/ will ignore /path/to/CVS/* but will not ignore /path/to/cvs

phpdoc -d /home/myhome/cvs/myproject -i cvs/ will ignore /home/myhome/cvs/myproject/files/cvs/* but will not ignore /home/myhome/cvs/*