vals2004/documentor-bundle

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

安装: 46

依赖者: 0

建议者: 0

安全: 0

星星: 0

观察者: 2

分支: 6

类型:symfony-bundle

v1.0 2015-11-26 19:31 UTC

This package is not auto-updated.

Last update: 2024-09-18 20:02:24 UTC


README

什么是 DocumentorBundle?

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

基本用法

  1. 为项目的开发环境安装并启用扩展包
  2. 运行 app/console documentation:create 以生成位于 ./src 目录下的文件的文档
  3. 您的项目文档现在在 web/bundles/documentorhttp://yourproject.dev/app_dev.php/bundles/documentor/index.html 可用

功能

DocumentorBundle 具有以下功能

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

要求

DocumentorBundle 需要以下条件

  • PHP 5.3.3 或更高版本

安装

建议的安装方法是使用 Composer

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

    {
        "require-dev": {
            "timhovius/phpdocumentor-bundle": "~1.0"
        }
    }
  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 Documentor\Bundle\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 访问它