artur-gajewski/documentor-bundle

一个用于将 phpDocumentor 集成到任何项目的 Symfony2 扩展包,使得文档可以通过浏览器访问。

dev-master 2013-09-17 11:42 UTC

This package is not auto-updated.

Last update: 2024-09-14 13:07:35 UTC


README

什么是 DocumentorBundle?

DocumentorBundle 是一个 Symfony2 扩展包,它封装了 phpDocumentor2 以生成项目的文档。

基本用法

  1. 为项目的开发环境安装并启用扩展包
  2. 运行 app/consoledocumentation:create 生成 ./src 中文件的文档
  3. 项目文档现在可在 web/bundles/documentorhttp://yourproject.dev/app_dev.php/bundles/documentor/index.html 访问

特性

DocumentorBundle 具有以下特性:

  • 通过简单的控制台命令生成文档。
  • 无需输入源路径和目标路径。
  • 可配置以确保仅在开发环境中运行。

要求

DocumentorBundle 需要以下条件:

  • PHP 5.3.3 或更高版本
  • phpDocumentor2
  • phpDocumentor2 应可从 CLI 作为 phpdoc 调用

安装

建议使用 Composer 进行安装

  1. 将 DocumentorBundle 添加到您的 composer.json 文件中

    {
        "require-dev": {
            "artur-gajewski/phpdocumentor-bundle": "dev-master"
        }
    }
  2. 告诉 Composer 更新此扩展包

    php composer.phar update artur-gajewski/phpdocumentor-bundle
  3. 为开发环境启用扩展包

    // app/AppKernel.php
    
        public function registerBundles()
        {
            // Register normal bundles
    
            if (in_array($this->getEnvironment(), array('dev', 'test'))) {
                // ...
                $bundles[] = new Aga\DocumentorBundle\DocumentorBundle();
            }
        }

如何使用 DocumentorBundle?

转到项目根目录,并使用扩展包内置的 DocumentorCommand 生成文档

$ app/console documentation:create

此命令将为 src/ 目录中的所有文件生成文档。

生成文档后,命令将执行 app/console assets:install 将新生成的文档复制到 web/bundles/documentor,您可以从磁盘或通过项目的网站在 http://yourproject.dev/app_dev.php/bundles/documentor/index.html 访问

联系方式

想要贡献吗?

如果您想为此项目做出贡献,只需将其分支、修改并提交拉取请求。这非常简单!