phpdocment2 安装与使用

  1. 安装命令
  在phpdoc依赖以下,安装之前确保下面已经存在
  • PHP 5.3.3
  • XSL extension for PHP, only applicable when generating HTML via XSL (生成html)  ,如果是wamp 直接开启extension=php_xsl.dll 就行
  • Graphviz, only applicable when generating Graphs (画图片)   
  • 下载并安装phpDocumentor生成类图需要的软件graphviz

    http://www.graphviz.org/Download_windows.php

    pear install Image_GraphViz

清除缓存
pear clear-cache
#(更新pear)
pear upgrade-all
$ pear channel-discover pear.phpdoc.org $ pear install phpdoc/phpDocumentor-beta 
 2.执行phpdoc 命令 
 创建  phpdoc.xml 文件, 保存于项目源码根目录

$ phpdoc
phpdoc 命令解释
phpdoc  --encoding="utf-8"

phpdoc   -d E:\bak\video\code  -t E:\bak\video\code\doc


-t|–target[=”...”]
存放生成的文档的 目录
-f|–filename[=”...”]

解析的文件名

-d|–directory[=”...”]

源码目录

–encoding[=”...”]
???
-e|–extensions[=”...”]
???
-i|–ignore[”...”]
Provide a comma-seeparated list of paths to skip when parsing.
–ignore-tags[=”...”]
???
–hidden
???
–ignore-symlinks
Tells the parser to not follow symlinks.
-m|–markers[=”...”]
Provide a comma-separated list of markers to parse.
–title[=”...”]

Specify a title for the documentation.

Title defaults to “phpDocumentor”.

–force
Ingore exceptions and continue parsing.
–validate
???
–visibility[=”...”]

Provide a comma-separated list of visibility scopes to parse.

This parameter may be used to tell phpDocumentor to only parse public properties and methods, or public and protected.

–defaultpackagename[=”...”]

–sourcecode

Starting with 0.16.0, Stores the sourcecode of each file with the structure.

When this parameter is provided the parser will add a compressed, base64-encoded version of the parsed file’s source as child element of the<file> element. This information can then be picked up by the transformer to generate a syntax highlighted view of the file’s source code and even have direct links to specific lines.

Currently the transformer will add a link to the given file’s source next to the name of the file in the top. In the future we will add direct links from elements to the line in this source code file.
-p|–progressbar

While running, show a short summary of generation progress.

When this parameter is provided the default lengthy command line output is replaced with a short overview of the generation status.

–template[=”...”]
Specify a template name, or a path to a directory where a custom template resides.
–parseprivate
Parse items marked with @internal despite their visibility.
-c|–config[=”...”]
Config file to use when parsing.







3 phpdoc.xml 配置

<?xml version="1.0" encoding="UTF-8"?>
<phpdoc>
    <title>会员自助系统CSS</title>
    <parser>
        <!-- phpdoc 缓存目录(源码缓存) -->
        <target>Api/build</target>
        <!--<default-package-name>默认包名</default-package-name>-->
    </parser>
    
    <transformer>
     <!-- Api文档存放目录 -->
        <target>Api/html</target>
    </transformer>
    
    <!-- 模板,phpdocment 提供了多套模板,名称为:abstract,checkstyle,new-black,old-ocean,responsive,zend--> 
    <transformations>
        <template name="new-black" />
    </transformations>
    <!-- 日志配置,注释错误或其他错误信息会记录到下面的文件 -->
<logging>
        <level>warn</level>
        <paths>
            <default>{APP_ROOT}/Api/log/{DATE}.log</default>
            <errors>{APP_ROOT}/Api/log/{DATE}.errors.log</errors>
        </paths>
    </logging>
    
    <!--注释文件,phpdoc 默认会读取php 后缀的文件 -->
    <files>
        <!--<file>test.php</file>-->
        <!--<file>bin/*</file>-->
        <file>src/Services/LadingService.class.php</file>
        <file>src/Services/LogService.class.php</file>
        <file>src/Services/ReceiptService.class.php</file>
        <file>src/Services/ServiceClientService.class.php</file>
        <file>src/Services/StockService.class.php</file>
        <file>src/Services/UserService.class.php</file>
<directory>src/Web/*</directory>
<directory>src/Cli/*</directory>
<!--忽略目录-->
<ignore>src/ThinkCommon/*</ignore>
        <ignore>src/ThinkPHP/*</ignore>
        <ignore>src/Upload/*</ignore>
        <ignore>src/Runtime/*</ignore>
        <ignore>src/Scripts/*</ignore>
        <ignore>src/Vendor/*</ignore>
    </files>
    
</phpdoc>


4 phpdoc 模板修改



找到PEAR\phpDocumentor\data\templates\abstract,这里目录是所有模板的基础,可以通过此修改等等,比如中文名

1.abstract\sidebar\sections.xsl 左边菜单项
2.abstract\sidebar\header.xsl 头部
3.abstract\sidebar\footer.xsl 底部

4.abstract\sidebar\sections 此目录存在右边内容的模板,包括文件,类,报告

20130801151529.jpg

4 \new-black\template.xml 模板设置,包括参数设置,样式,js的加载
   <transformation writer="xsl" source="templates/new-black/sidebar.xsl" artifact="nav.html">
        <parameters>
            <variables>
                <section.dashboard.show>false</section.dashboard.show>
                <section.api.show/>
                <section.namespaces.show>false</section.namespaces.show>
                <section.packages.show/>
                <section.files.show/>
                <section.files.show-elements/>
                <section.reports.show />
                <section.charts.show />
            </variables>
        </parameters>
    </transformation>


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值