alex20465 / sphpdox
PHPDoc 到 Sphinx phpdomain 工具
dev-master
2015-12-21 15:00 UTC
Requires
- php: >=5.3.2
- andrewsville/php-token-reflection: >=1.3.0
- symfony/console: >=2.0.10
- symfony/process: >=2.0.10
Requires (Dev)
- phpunit/phpunit: >=1.6
This package is not auto-updated.
Last update: 2024-09-18 17:38:25 UTC
README
Sphpdox
PHPDoc 到 Sphinx phpdomain
正在为您的 PHP 项目编写 ReStructuredText 文档?已经使用 docblocks 有了良好的 PHP 代码文档?使用此工具生成与 Sphinx 的 sphinxcontrib-phpdomain 兼容的 API 文档。
该名称是 'sphinx' 和 'phpdoc' 的混合。
安装
兼容 PSR-0。供应商命名空间为 Sphpdox。
composer
Sphpdox 作为 sphpdox/sphpdox
在 Packagist 上提供。
{ ... "require": { "sphpdox/sphpdox": "dev-master" } }
功能
Sphpdox 读取您的命名空间源代码目录。它找到文档化的类、方法、属性等,并使用 sphinxcontrib
中的 phpdomain
生成 ReStructuredText 格式的文档。它将这个库
lib
├── SplClassLoader.php
└── Wrench
├── Application
│ ├── Application.php
│ └── EchoApplication.php
├── BasicServer.php
├── Client.php
├── ConnectionManager.php
├── Connection.php
├── Frame
│ ├── Frame.php
│ └── HybiFrame.php
├── Listener
│ ├── HandshakeRequestListener.php
│ ├── Listener.php
│ ├── OriginPolicy.php
│ └── RateLimiter.php
├── Payload
│ ├── HybiPayload.php
│ └── Payload.php
├── Protocol
│ ├── Hybi10Protocol.php
│ ├── HybiProtocol.php
│ ├── Protocol.php
│ └── Rfc6455Protocol.php
├── Resource.php
├── Server.php
├── Socket
│ ├── ClientSocket.php
│ ├── ServerClientSocket.php
│ ├── ServerSocket.php
│ ├── Socket.php
│ └── UriSocket.php
└── Util
├── Configurable.php
└── Ssl.php
转换成这样的文档树
build/Wrench/
├── Application
│ ├── Application.rst
│ ├── EchoApplication.rst
│ └── index.rst
├── BasicServer.rst
├── Client.rst
├── ConnectionManager.rst
├── Connection.rst
├── Frame
│ ├── Frame.rst
│ ├── HybiFrame.rst
│ └── index.rst
├── index.rst
├── Listener
│ ├── HandshakeRequestListener.rst
│ ├── index.rst
│ ├── Listener.rst
│ ├── OriginPolicy.rst
│ └── RateLimiter.rst
├── Payload
│ ├── HybiPayload.rst
│ ├── index.rst
│ └── Payload.rst
├── Protocol
│ ├── Hybi10Protocol.rst
│ ├── HybiProtocol.rst
│ ├── index.rst
│ ├── Protocol.rst
│ └── Rfc6455Protocol.rst
├── Resource.rst
├── Server.rst
├── Socket
│ ├── ClientSocket.rst
│ ├── index.rst
│ ├── ServerClientSocket.rst
│ ├── ServerSocket.rst
│ ├── Socket.rst
│ └── UriSocket.rst
└── Util
├── Configurable.rst
├── index.rst
└── Ssl.rst
其中每个文件都包含类的文档,例如
.. php:class:: DateTime Datetime class .. php:method:: setDate($year, $month, $day) Set the date. :param int $year: The year. :param int $month: The month. :param int $day: The day. :returns: Either false on failure, or the datetime object for method chaining. .. php:method:: setTime($hour, $minute[, $second]) Set the time. :param int $hour: The hour :param int $minute: The minute :param int $second: The second :returns: Either false on failure, or the datetime object for method chaining. .. php:const:: ATOM Y-m-d\TH:i:sP
用法
./sphpdox.php help
用于获取帮助。主要命令是 process
。如果不提供任何参数,将会交互式地询问。
以下是 process
命令的内置帮助
$./sphpdox.php help process
Usage:
process [-o|--output="..."] [-t|--title="..."] [-x|--exclude="..."] namespace path
Arguments:
namespace The namespace to process
path The path the namespace can be found in
Options:
--output (-o) The path to output the ReST files (default: build)
--title (-t) An alternate title for the top level namespace
--exclude (-x) Semicolon separated namespaces to ignore
Help:
The process command works recursively on a directory of PHP code.
库
Sphpdox 使用 Symfony Console 组件和 PHP-Token-Reflection。我强烈建议您使用 composer 安装 sphpdox,以避免查找依赖。
许可证
sphpdox 根据 GPL-3.0+ 发布