SlideShare a Scribd company logo
phpDocumentor使用及方法簡要Cloud2011 Aircamel Copyright 1
文件的重要 “Writing good documentation is essential to the success of any software project.”http://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/tutorial_phpDocumentor.pkg.html特別是 OOS 項目2011 Aircamel Copyright 2
文件的類型Client User教學或使用文件開發人員案例:API文檔2011 Aircamel Copyright 3
What’s phpDocumentorHPDocumentor是一個用PHP寫的工具,對於有規範註釋的php程式。它能夠快速生成具有相互參照,索引等功能的API文檔。可以通過在客戶端瀏覽器上操作生成文檔,文檔可以轉換為PDF,HTML,CHM幾種形式,非常的方便。2011 Aircamel Copyright 4
How’s Work掃描指定目錄下面的php原始碼,掃描其中的關鍵字,截取須要分析的註釋,然後分析註釋中的專用的tag,生成 xml文件接着根據已經分析完的類別和區塊的訊息,建立相應的索引,生成xml文件對於生成的xml文件,運用定制的模板輸出為指定格式的文件 2011 Aircamel Copyright 5
ExamplePEAR API Documentationhttp://pear.php.net/package/Auth/docs/latest/Zend Frameworkhttp://framework.zend.com/apidoc/coresymfonyhttp://www.symfony-project.org/api/1_22011 Aircamel Copyright 6
How to InstallphpDocumentor的安裝分為自動安裝和手動安裝兩種方式通過pear 自動安裝pear install PhpDocumentor手動安裝在http://manual.phpdoc.org/下載最新版本的PhpDocumentor把內容解壓即可。 2011 Aircamel Copyright 7
如何使用所有的註釋都是由/**開始的一個多行註釋,在phpDocumentor裡稱為DocBlock, DocBlock是指軟體開發人員編寫的關於某個關鍵字的幫助訊息,使得 其他人能夠通過它知道這個關鍵字的具體用途,如何運用 。PhpDocumentor規定 一個DocBlock包含如下訊息:功能簡述區 (Short Description)詳細說明區 (Long Description)標記tag 2011 Aircamel Copyright 8
DocBlock/*** Short description ** Long description. This is an sample function * to show the DocBlock format.** 2nd paragraph of long description. * * * @tag1 * @tag2 */2011 Aircamel Copyright 9
Short Description正文一般是簡明扼要地說明這個類別,方法或者 函數的功能。功能簡述的正文在生成的文檔中將顯示在索引區。功能描述區的內容可 以通過一個空行或者 */ 來 結束。2011 Aircamel Copyright 10
Long Description在功能描述區後是一個空行,接着是詳細說明區,這部分主要是詳細說明你的API的 功能,用途,如果可能,也可以有用法舉例等等。2011 Aircamel Copyright 11
Long Description/*** - unordered item A * - unordered item B * * 1 ordered item A * 2 ordered item B */2011 Aircamel Copyright 12
Long Description無長度限制可以多行一些HTML標籤使用 b, code, br, i, kbd, li, ol, p, pre, samp, ul, var2011 Aircamel Copyright 13
Tags位於Long Description 後一個空白行指明一些參數上的訊息,主要是參數類型回傳值類型繼承聯系2011 Aircamel Copyright 14
@author@author aurthorname<name@example.com>描述作者E - mail 可以怱略2011 Aircamel Copyright 15
@license顯示版權及 URL例:@license http://opensource.org/licenses/api/licenese.php GUN Public License2011 Aircamel Copyright 16@license authorname<name@example.com>
@package出此檔是屬於哪個 package , package 的名字和程式沒有關係,可以自由指定。指定它的用途只是方便管理檔案,讓相關的檔案在產生的註解文件中可以放一起呈現。2011 Aircamel Copyright 17
@param變數及型態的說明PHP 內的類型提示(Type Hinting)例:@paramint $num@parambool|string $foo a bool or string param2011 Aircamel Copyright 18@paramdatatype$paramnamedescription
@return函數回傳表示回傳值的型態例:@return mixed@return fooClass|falsefooClass object or error2011 Aircamel Copyright 19@return datatypedescript
DocBlock Template解決當重覆的列出相同的變數與方法許多遍時,造成的不良這樣的情況叫DocBlock Template2011 Aircamel Copyright 20
DocBlock Template/**#@+* @access private* @var string*/var $_var1 = ‘Hello’;var $_var2 = ‘World’;...var $_varN;/**#@-*///下面的說明,不適用var $varX = array();2011 Aircamel Copyright 21
說明檔的產生phpdoc-o HTML:frames:earthli -f sample1.php -t docs2011 Aircamel Copyright 22
Option-d:指定的產生目錄中的代碼-t :指定目標的文件-o:輸出格式,指定模板2011 Aircamel Copyright 23
Template你可以自己/選擇輸出格式HTML - SmartCHM - Windows help 的模板可PDF - Adobe Acrobat 形式XML:DocBook的 - 可重複使用為出發2011 Aircamel Copyright 24
PHPDocument是從你原始碼的註釋中生成文檔,因此在在你程式中做註釋的流程 ,也就是你編製文檔的流程 。促使養成良好的編程習慣,盡量運用規範,清晰的文字為程式做註釋,同時多多少少也防止 了事後編製文檔和文檔的更新不同步的一些問題。2011 Aircamel Copyright 25
更多資訊http://www.phpdoc.orghttp://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/tutorial_phpDocumentor.howto.pkg.html2011 Aircamel Copyright 26
感謝大家結束2011 Aircamel Copyright 27
Ad

Recommended

Php documentor
Php documentor
Cloud Liao
 
2024 Trend Updates: What Really Works In SEO & Content Marketing
2024 Trend Updates: What Really Works In SEO & Content Marketing
Search Engine Journal
 
Storytelling For The Web: Integrate Storytelling in your Design Process
Storytelling For The Web: Integrate Storytelling in your Design Process
Chiara Aliotta
 
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
OECD Directorate for Financial and Enterprise Affairs
 
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
SocialHRCamp
 
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
 
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
 
How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
 
Introduction to Data Science
Introduction to Data Science
Christy Abraham Joy
 
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
 
The six step guide to practical project management
The six step guide to practical project management
MindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
GetSmarter
 
ChatGPT webinar slides
ChatGPT webinar slides
Alireza Esmikhani
 

More Related Content

Featured (20)

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
 
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
 
How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
 
Introduction to Data Science
Introduction to Data Science
Christy Abraham Joy
 
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
 
The six step guide to practical project management
The six step guide to practical project management
MindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
GetSmarter
 
ChatGPT webinar slides
ChatGPT webinar slides
Alireza Esmikhani
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
 
The six step guide to practical project management
The six step guide to practical project management
MindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
GetSmarter
 

Php documentor