0%

phpDocument的牢骚

2017年8月19日 上午11:34

官方网站:https://phpdoc.org/

起因:我最近在看TP的源码,想做出一个html文档作为辅助

牢骚

  1. 官方网站中的system requrement,能不能标明那些是必须的、哪些是附加的!出现错误的时候至少排除不是环境的问题
  2. 官方网站中能不能有一个Q&A,出了错我都不知道去哪找,百度中的资料,大家的情况基本上都不一样,抄来抄去,不但学不到东西、弄不懂原理,而且八成还解决不了问题
  3. phpDocument你行不行,不知道大家用的不同的系统的,能不能说一说不同电脑之间的区别。百度上都没有一个关于mac上用pear安装phpDocument的文档,注意是一个!我安装下来各种报错
  4. 最后埋怨埋怨我
    1. 看资料能不能不着急!尤其是english,你不知道english不好吗!
      1. 把 “PHAR”看成“PEAR”,这不是第一次了。这最起码就浪费了1个多小时
      2. 看Stack Overflow里的文章,先看懂人家的情况和自己一样不,不要就是着急找答案,人家问题你都不仔细看,能找见个屁!
    2. 学习不是一日之工,是水到渠成。还是不要着急,保持一个清晰的思维
  5. TP你能为啥就不按phpDocument的格式写,你瞧不起外国人的东西啊(做的好!)

这次的问题我做的比较好的地方(第三点是最核心的)

  1. 学习phpDocument首先想到是官方文档,先进行了文档的阅读,按着文档的思路来做
  2. 我最后实在解决不了问题1、问题2。是按着官方文档的方法去试的第二种,从百度中乱七八糟的东西中抽出身来。事实证明我是对的
  3. 对于那些报错,我最后觉得是我解决不了的问题,因为他的报错中涉及到了这个软件本身的代码,以及一些php整个原理上的东西。我首先对人家代码不了解,其次我对php整个的运行过程并不熟悉,只是会做不涉及php本质的项目。我既然目前的知识体系不足,就没必要在自己肯定解决不了的问题中徘徊,弄的自己蓬头垢面

附录:

Pear安装过程

1
2
3
4
5
6
7
8
9
10
11
czhdeMacBook-Pro:.ssh czh$ sudo pear channel-discover pear.phpdoc.org
Password:
Adding Channel "pear.phpdoc.org" succeeded
Discovery of channel "pear.phpdoc.org" succeeded
czhdeMacBook-Pro:.ssh czh$ pear install phpdoc/phpDocumentor
Cannot install, php_dir for channel "pear.phpdoc.org" is not writeable by the current user
czhdeMacBook-Pro:.ssh czh$ sudo pear install phpdoc/phpDocumentor
downloading phpDocumentor-2.9.0.tgz ...
Starting to download phpDocumentor-2.9.0.tgz (16,175,113 bytes)
...............................................................................done: 16,175,113 bytes
install ok: channel://pear.phpdoc.org/phpDocumentor-2.9.0

(第一个错)-解决不了

1
2
3
4
5
czhdeMacBook-Pro:thinkphp_3.2.3 czh$ php phpDocumentor.phar -d . -t docs/api
Could not open input file: phpDocumentor.phar
czhdeMacBook-Pro:thinkphp_3.2.3 czh$ sudo php phpDocumentor.phar -d . -t docs/api
Password:
Could not open input file: phpDocumentor.phar

(更改路径之后报的第二个错)—解决不了也

1
2
3
4
5
6
7
8
czhdeMacBook-Pro:thinkphp_3.2.3 czh$  phpdoc -d ./ThinkPHP -t ./docs/api
PHP Warning: require_once(/dompdf/dompdf/dompdf_config.inc.php): failed to open stream: No such file or directory in /usr/local/pear/share/pear/phpDocumentor/src/phpDocumentor/Bootstrap.php on line 178

Warning: require_once(/dompdf/dompdf/dompdf_config.inc.php): failed to open stream: No such file or directory in /usr/local/pear/share/pear/phpDocumentor/src/phpDocumentor/Bootstrap.php on line 178
PHP Fatal error: require_once(): Failed opening required '/dompdf/dompdf/dompdf_config.inc.php' (include_path='.:/usr/local/pear/share/pear') in /usr/local/pear/share/pear/phpDocumentor/src/phpDocumentor/Bootstrap.php on line 178

Fatal error: require_once(): Failed opening required '/dompdf/dompdf/dompdf_config.inc.php' (include_path='.:/usr/local/pear/share/pear') in /usr/local/pear/share/pear/phpDocumentor/src/phpDocumentor/Bootstrap.php on line 178
czhdeMacBook-Pro:thinkphp_3.2.3 czh$

我换用PHAR安装后,发现能行了(phpDocumentor.phar方式)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
bogon:~ czh$ php phpDocumentor.phar -d test -t docs/api
Collecting files .. OK
Initializing parser .. OK
Parsing files
Parsing /Users/czh/test/test.php
Storing cache in "/Users/czh/docs/api" .. OK
Load cache .. 0.000s
Preparing template "clean" .. 0.003s
Preparing 17 transformations .. 0.000s
Build "elements" index .. 0.000s
Replace textual FQCNs with object aliases .. 0.000s
Resolve @link and @see tags in descriptions .. 0.000s
Enriches inline example tags with their sources .. 0.000s
Build "packages" index .. 0.000s
Build "namespaces" index and add namespaces to "elements" .. 0.000s
Collect all markers embedded in tags .. 0.000s
Transform analyzed project into artifacts ..
Applying 17 transformations
Initialize writer "phpDocumentor\Plugin\Core\Transformer\Writer\FileIo"
Initialize writer "phpDocumentor\Plugin\Twig\Writer\Twig"
Initialize writer "phpDocumentor\Plugin\Graphs\Writer\Graph"
Execute transformation using writer "FileIo"
Execute transformation using writer "FileIo"
Execute transformation using writer "FileIo"
Execute transformation using writer "FileIo"
Execute transformation using writer "FileIo"
Execute transformation using writer "twig"
Execute transformation using writer "twig"
Execute transformation using writer "twig"
Execute transformation using writer "twig"
Execute transformation using writer "twig"
Execute transformation using writer "twig"
Execute transformation using writer "twig"
Execute transformation using writer "twig"
Execute transformation using writer "twig"
Execute transformation using writer "twig"
Execute transformation using writer "twig"
Execute transformation using writer "Graph"
Unable to find the `dot` command of the GraphViz package. Is GraphViz correctly installed and present in your path? 0.164s
Analyze results and write report to log .. 0.000s
bogon:~ czh$

(报的第三个错)(phpDocumentor.phar方式)
说明:phpDocumentor.phar 这个必须在当前目录下(我觉着改改路径其他目录也行,没试)

1
2
bogon:htdocs czh$ php phpDocumentor.phar -d test -t docs/api
Could not open input file: phpDocumentor.phar

看看成果吧!


注:我倒是没琢磨这个具体怎么用,和javadoc有区别