ridi / doxphp
PHP 的 Dox,受 JavaScript 的 Dox 启发。
0.2.2
2018-11-14 05:54 UTC
Requires
- php: >=5.3.2
This package is not auto-updated.
Last update: 2024-09-18 10:47:55 UTC
README
Dox for PHP 是一个受 JavaScript 的 Dox 启发的 PHP 文档引擎。
安装
Pear
pear channel-discover pear.avalanche123.com pear install avalanche123/doxphp-beta
Github
克隆此仓库,并将 doxphp
放置在您的可执行路径下的 bin 目录。
使用
Dox PHP 在 stdio 上操作
$ doxphp < test.php
...JSON...
test.php
<?php /** * Greets the world * * @author Bulat Shakirzyanov <mallluhuct@gmail.com> (http://avalanche123.com) * * @param string $world - the world to greet * * @return void */ function hello($world) { echo "Hello ${world}"; }
输出
[ { "tags": [ { "type" : "author" , "email" : "mallluhuct@gmail.com" , "website": "http:\/\/avalanche123.com" , "name" : "Bulat Shakirzyanov" } , { "type" : "param" , "types" : [ "string" ] , "name" : "world" , "description": "- the world to greet" } , { "type" : "return" , "types": [ "void" ] } ] , "description": "Greets the world" , "isPrivate" : false , "isProtected": false , "isPublic" : true , "isAbstract" : false , "isFinal" : false , "isStatic" : false , "code" : "function hello($world)" , "type" : "function" , "name" : "hello()" , "line" : 12 } ]
支持
- 类和接口
- 函数和方法(产生略微不同的结果)
- 命名空间(谁真的使用 phpdocs?)
- 类变量和常量(太棒了!)
安装
使用 pear 安装
pear channel-discover pear.avalanche123.com pear install avalanche123/doxphp-alpha
渲染器
- doxphp2sphinx
doxphp < test.php | doxphp2sphinx > test.rst
test.rst
.. php:function:: hello Greets the world :param string $world: - the world to greet :returns void:
- doxphp2docco
doxphp2docco *.php
这将在当前目录中创建 docs
目录,并用 HTML 文件填充它。
test.html
<!DOCTYPE html> <html> <head> <title>test.php</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="resources/doxphp.css" /> </head> <body> <div id="container"> <div id="background"></div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1>test.php</h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">¶</a> </div> <p>Greets the world</p> </td> <td class="code"> <div class="highlight"> <pre> <span class="cp"><?php</span> <span class="k">function</span> <span class="nf">hello</span> <span class="p">(</span> <span class="nv">$world</span> <span class="p">)</span> </pre> </div> </td> </tr> </tbody> </table> </div> </body> </html>
待办事项
实现更多渲染器