Dox PHP
Dox for PHP is a documentation engine for PHP inspired by the Dox for JavaScript., (*1)
Installation
Pear
pear channel-discover pear.avalanche123.com
pear install avalanche123/doxphp-beta
Github
Clone this repository and put the doxphp
under bin directory in your executable path., (*2)
Usage
Dox PHP operates over stdio:, (*3)
$ doxphp < test.php
...JSON...
test.php, (*4)
<?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}";
}
output, (*5)
[
{
"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
}
]
Supports
- classes and interfaces
- functions and methods (produces slightly different results)
- namespaces (who phpdocs them really?)
- class variables and constants (sweet!)
Installation
Use pear to install, (*6)
pear channel-discover pear.avalanche123.com
pear install avalanche123/doxphp-alpha
Renderers
doxphp < test.php | doxphp2sphinx > test.rst
test.rst:, (*7)
.. php:function:: hello
Greets the world
:param string $world: - the world to greet
:returns void:
doxphp2docco *.php
this creates docs
directory in the current directory and populates it with html files., (*8)
test.html:, (*9)
<!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>
test.php
|
|
Greets the world, (*10)
|
<?php
function
hello
(
$world
)
|
</body>
</html>
TODO
implement more renderers, (*11)