如何製做一份接口文檔(PHP版本)

mac osx brew 安裝的php默認狀況是沒有安裝pear的,須要手工安裝,方法以下:php

1.轉到php bin目錄html

wget https://pear.php.net/go-pear.phar

php go-pear.phar

安裝文檔 http://pear.php.net/manual/en/installation.getting.phpgit

Pear倉庫仍是有不少有趣的共用組件的,參考下 http://pear.php.net/packages.phpgithub

2.安裝phpdocumentbash

pear channel-discover pear.phpdoc.org

pear install phpdoc/phpDocumentor

brew install GraphViz

https://github.com/phpDocumentor/phpDocumentor2ide

3.使用phpdocument生成文檔this

phpdoc -d projects_source_dir -t /save_project_document_to/

phpdocument更多使用說明,參考官網 https://www.phpdoc.org/docs/latest/index.html.net

例子:code

/**
  * Counts the number of items in the provided array.
  *
  * @todo add an array parameter to count
  * @link http://example.com/my/bar Documentation of Foo.
  * @see http://example.com/my/bar Documentation of Foo.
  * @see MyClass::$items           For the property whose items are counted.
  * @see MyClass::setItems()       To set the items for this collection.
  *
  * @return string|null The label's text or null if none provided.
  */
 function getLabel()
 {
     <...>
 }
相關文章
相關標籤/搜索