Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<refentry id="{@id}">
2
 <refnamediv>
3
  <refname>{@link http://pear.php.net/package/PhpDocumentor phpDocumentor} Tutorial</refname>
4
  <refpurpose>An in-depth look at using phpDocumentor to document PHP Source Code, and phpDocumentor internals</refpurpose>
5
 </refnamediv>
6
 <refsynopsisdiv>
7
  <author>
8
   Gregory Beaver
9
   <authorblurb>
10
    Tutorial written by {@link mailto:cellog@php.net cellog@php.net}
11
   </authorblurb>
12
  </author>
13
 </refsynopsisdiv>
14
 {@toc}
15
 <refsect1 id="{@id intro}">
16
   <title>Introduction</title>
17
   <para>phpDocumentor is the most advanced automatic documentation system written for PHP, in PHP. This package has many features:</para>
18
   <para>
19
    <itemizedlist>
20
	 <listitem><para><emphasis>NEW</emphasis> The first auto-documentor with PHP 5 support</para></listitem>
21
     <listitem><para>Extended documentation in docbook format with linking to any element and to other documentation,
22
      including sub-sections, from the source code (see {@tutorial tutorials.pkg})</para></listitem>
23
     <listitem><para>docblock templates to cut down on repetition</para></listitem>
24
     <listitem><para>XML:DocBook:peardoc2 templates for PEAR developers</para></listitem>
25
     <listitem><para>Greater ease of extending a Converter, see {@tutorial Converters/Converters.pkg}</para></listitem>
26
     <listitem><para>ability to parse any PHP file, regardless of documentation format</para></listitem>
27
     <listitem><para>conforms loosely to the {@link http://java.sun.com/docs/books/jls/first_edition/html/18.doc.html JavaDOC protocol},
28
     and will be familiar to Java programmers</para></listitem>
29
     <listitem><para>documents all includes, constants, functions, static functions, classes,
30
      methods, static variables, class variables, and can document global variables and
31
      external tutorials</para></listitem>
32
     <listitem><para>auto-linking to pre-defined PHP functions</para></listitem>
33
     <listitem><para>Output in HTML, CHM, PDF, XML DocBook formats</para></listitem>
34
     <listitem><para>templateable with many bundled templates</para></listitem>
35
     <listitem><para>automatic linking to elements in any documented package</para></listitem>
36
     <listitem><para>documents name conflicts between packages to help avoid PHP errors</para></listitem>
37
     <listitem><para>document CVS repository directly.</para></listitem>
38
     <listitem><para>support for JavaDoc doclet-like output through Converters</para></listitem>
39
     <listitem><para>error/warning tracking system</para></listitem>
40
     <listitem><para>extreme class intelligence: inherits documentation, package</para></listitem>
41
     <listitem><para>complete phpdoc.de DocBlock tag support.  Additions include @var, @magic, @deprec, @todo, and phpdoc.de parsing of @param.</para></listitem>
42
     <listitem><para>alphabetical indexing of all elements by package and overall</para></listitem>
43
     <listitem><para>class trees</para></listitem>
44
     <listitem><para>MUCH more than just this short list</para></listitem>
45
    </itemizedlist>
46
   </para>
47
 </refsect1>
48
 <refsect1 id="{@id basics}">
49
  <title>phpDocumentor Basics</title>
50
  <refsect2 id="{@id starting}">
51
   <title>Starting Out From Scratch</title>
52
   <para>The documentation process begins with the most basic element of phpDocumentor: a
53
    <emphasis>Documentation block </emphasis> or <emphasis>DocBlock</emphasis>. A basic
54
    DocBlock looks like this:
55
   </para>
56
   <para>
57
    <programlisting role="php">
58
    <![CDATA[
59
/**
60
 *
61
 */
62
    ]]>
63
    </programlisting>
64
   </para>
65
   <para>A DocBlock is an extended C++-style PHP comment that begins with &quot;/**&quot; and has
66
    an &quot;*&quot; at the beginning of every line.  DocBlocks precede the element they are documenting.
67
   </para>
68
   <caution>Any line within a DocBlock that doesn't begin with a * will be ignored.</caution>
69
   <para>To document function &quot;foo()&quot;, place the DocBlock immediately before the function declaration:</para>
70
   <para>
71
    <programlisting role="php">
72
    <![CDATA[
73
/**
74
 * Defies imagination, extends boundaries and saves the world ...all before breakfast!
75
 */
76
function foo()
77
{
78
}
79
    ]]>
80
    </programlisting>
81
   </para>
82
   <para>This example will apply the DocBlock to &quot;define('me',2);&quot; instead of to &quot;function foo()&quot;:
83
   <programlisting role="php">
84
   <![CDATA[
85
/**
86
 * DocBlock for function foo?
87
 *
88
 * No, this will be for the constant me!
89
 */
90
define('me',2);
91
function foo($param = me)
92
{
93
}
94
   ]]>
95
   </programlisting>
96
   </para>
97
   <para>define() statements, functions, classes, class methods, and class vars, include()
98
    statements, and global variables can all be documented, see
99
    {@tutorial phpDocumentor.howto.pkg#documenting.elements}
100
   </para>
101
  </refsect2>
102
  <refsect2 id="{@id docblock}">
103
   <title>DocBlocks</title>
104
   <para>A DocBlock contains three basic segments in this order:</para>
105
   <para>
106
    <itemizedlist>
107
     <listitem><para>Short Description</para></listitem>
108
     <listitem><para>Long Description</para></listitem>
109
     <listitem><para>Tags</para></listitem>
110
    </itemizedlist>
111
   </para>
112
   <para>The Short Description starts on the first line, and can be terminated with a blank line
113
    or a period. A period inside a word (like example.com or 0.1 %) is ignored. If the Short
114
    Description would become more than three lines long, only the first line is taken. The Long
115
    Description continues for as many lines as desired and may contain html markup for display
116
    formatting.  Here is a sample DocBlock with a Short and a Long Description:
117
   </para>
118
   <para>
119
    <programlisting role="php">
120
    <![CDATA[
121
/**
122
 * return the date of Easter
123
 *
124
 * Using the formula from "Formulas that are way too complicated for anyone to
125
 * ever understand except for me" by Irwin Nerdy, this function calculates the
126
 * date of Easter given a date in the Ancient Mayan Calendar, if you can also
127
 * guess the birthday of the author.
128
 */
129
    ]]>
130
    </programlisting>
131
   </para>
132
   <para>Optionally, you may enclose all paragraphs in a &lt;p&gt;&lt;/p&gt; tag.  Be careful,
133
    if the first paragraph does not begin with &lt;p&gt;, phpDocumentor will assume that the
134
    DocBlock is using the simple double linebreak to define paragraph breaks as in:
135
   </para>
136
   <para>
137
    <programlisting role="php">
138
    <![CDATA[
139
/**
140
 * Short desc
141
 *
142
 * Long description first sentence starts here
143
 * and continues on this line for a while
144
 * finally concluding here at the end of
145
 * this paragraph
146
 *
147
 * The blank line above denotes a paragraph break
148
 */
149
    ]]>
150
    </programlisting>
151
   </para>
152
   <para>Here is an example of using &lt;p&gt;</para>
153
   <para>
154
    <programlisting role="php">
155
    <![CDATA[
156
/**
157
 * Short desc
158
 *
159
 * <p>Long description first sentence starts here
160
 * and continues on this line for a while
161
 * finally concluding here at the end of
162
 * this paragraph</p>
163
 * This text is completely ignored! it is not enclosed in p tags
164
 * <p>This is a new paragraph</p>
165
 */
166
    ]]>
167
    </programlisting>
168
   </para>
169
   <para>phpDocumentor also supports JavaDoc's DocBlock format through the command-line
170
    option {@tutorial phpDocumentor.howto.pkg#using.command-line.javadocdesc}.  Due to
171
    the non-xhtml compliant unmatched p tag, we highly recommend you avoid this syntax
172
    whenever possible
173
   </para>
174
   <para>
175
    <programlisting role="php">
176
    <![CDATA[
177
/**
178
 * <p>
179
 * Short desc is only to the first period.
180
 * This means a sentence like:
181
 * "Parses Mr./Mrs. out of $_GET." will
182
 * parse a short description of "Parses Mr."
183
 * which is rather silly.  Long description is
184
 * the entire DocBlock description including the
185
 * Short desc, and paragraphs begin where p is like:
186
 * <p>
187
 * The p above denotes a paragraph break
188
 */
189
    ]]>
190
    </programlisting>
191
   </para>
192
   <para>phpDocumentor will convert all whitespace into a single space in the
193
    long description, use paragraph breaks to define newlines, or &lt;pre&gt;,
194
    as discussed in the next section.</para>
195
  </refsect2>
196
  <refsect2 id="{@id desc}">
197
   <title>DocBlock Description details</title>
198
   <para>As of phpDocumentor 1.2.0, the long and short description of a DocBlock
199
    is parsed for a few select html tags that determine additional formatting.  Due
200
    to the nature of phpDocumentor's output as multiple-format, straight html is not
201
    allowed in a DocBlock, and will be converted into plain text by all of the
202
    converters unless it is one of these tags:
203
    <itemizedlist>
204
     <listitem><para>&lt;b&gt; -- emphasize/bold text</para></listitem>
205
     <listitem><para>&lt;code&gt; -- Use this to surround php code, some converters will highlight it</para></listitem>
206
     <listitem><para>&lt;br&gt; -- hard line break, may be ignored by some converters</para></listitem>
207
     <listitem><para>&lt;i&gt; -- italicize/mark as important</para></listitem>
208
     <listitem><para>&lt;kbd&gt; -- denote keyboard input/screen display</para></listitem>
209
     <listitem><para>&lt;li&gt; -- list item</para></listitem>
210
     <listitem><para>&lt;ol&gt; -- ordered list</para></listitem>
211
     <listitem><para>&lt;p&gt; -- If used to enclose all paragraphs, otherwise it will be considered text</para></listitem>
212
     <listitem><para>&lt;pre&gt; -- Preserve line breaks and spacing, and assume all tags are text (like XML's CDATA)</para></listitem>
213
     <listitem><para>&lt;samp&gt; -- denote sample or examples (non-php)</para></listitem>
214
     <listitem><para>&lt;ul&gt; -- unordered list</para></listitem>
215
     <listitem><para>&lt;var&gt; -- denote a variable name</para></listitem>
216
    </itemizedlist>
217
    Do not think of these tags as text, they are parsed into objects and converted
218
    into the appropriate output format by the converter.  So, a b tag may become
219
    &lt;emphasis&gt; in DocBook, and a &lt;p&gt; tag might become <![CDATA["    "]]> (4 spaces)
220
    in the PDF converter!  The text output is determined by the template options file
221
    options.ini found in the base directory of every template.  For instance, the
222
    options.ini file for the HTML:frames:default template is in
223
    phpDocumentor/Converters/HTML/frames/templates/default/options.ini
224
   </para>
225
   <para>For the rare case when the text &quot;&lt;b&gt;&quot; is needed in a DocBlock,
226
    use a double delimiter as in &lt;&lt;b&gt;&gt;.  phpDocumentor will automatically
227
    translate that to the physical text &quot;&lt;b&gt;&quot;.
228
   </para>
229
   <para>Similarly, if you need an actual &quot;@&quot; in your DocBlock's description parts,
230
   you should be careful to either ensure it is not the first character on a line,
231
   or else escape it (&quot;\@&quot;) to avoid it being interpreted as a PhpDocumentor tag marker.
232
   </para>
233
   <para>
234
    <programlisting role="php">
235
    <![CDATA[
236
/**
237
 * Demonstrate an @include file
238
 * line in a code block:
239
 *
240
 * <code>
241
 * \@include somefile.php
242
 * </code>
243
 */
244
    ]]>
245
    </programlisting>
246
   </para>
247
   <para>This will parse as if it were:</para>
248
   <para>
249
    <programlisting role="php">
250
    <![CDATA[
251
/**
252
 * Demonstrate an @include file
253
 * line in a code block:
254
 *
255
 * <code>
256
 * @include somefile.php
257
 * </code>
258
 */
259
    ]]>
260
    </programlisting>
261
   </para>
262
   <para>
263
   </para>
264
   <note>
265
    <title>Using &lt;code&gt; &lt;kbd&gt; &lt;pre&gt;</title>
266
    The &lt;code&gt;, &lt;kbd&gt;, and &lt;pre&gt; tags ignore any html listed above
267
    except for their own closing tags (&lt;/code&gt; &lt;/kbd&gt; &lt;/pre&gt;).
268
    This is obviously necessary for each of those tag's behavior of controlling the appearance of the text
269
    inside their tag blocks, without allowing other nested tags (like &lt;b&gt;) interfering inside them.
270
    In general, other tags will allow other tags to be nested in them
271
    (i.e. &lt;samp&gt;&lt;b&gt;bold_my_sample&lt;/b&gt;&lt;/samp&gt;).
272
   </note>
273
   <para><emphasis>New 1.2.0rc1:</emphasis> If you need to use the closing comment &quot;*/&quot;
274
    in a DocBlock, use the special escape sequence &quot;{@*}.&quot;  Here's an example:
275
   </para>
276
   <para>
277
    <programlisting role="php">
278
    <![CDATA[
279
/**
280
 * Simple DocBlock with a code example containing a docblock
281
 *
282
 * <code>
283
 *  /**
284
 *   * My sample DocBlock in code
285
 *   {@}*}
286
 * </code>
287
 */
288
    ]]>
289
    </programlisting>
290
   </para>
291
   <para>This will parse as if it were:</para>
292
   <para>
293
    <programlisting role="php">
294
    <![CDATA[
295
/**
296
 * Simple DocBlock with a code example containing a docblock
297
 *
298
 * <code>
299
 *  /**
300
 *   * My sample DocBlock in code
301
 *   */
302
 * </code>
303
 */
304
    ]]>
305
    </programlisting>
306
   </para>
307
   <para><emphasis>New 1.2.0rc1:</emphasis> The phpEdit tool supports very clever list
308
    extraction from DocBlocks, and now phpDocumentor supports the same cleverness.  This example:
309
   </para>
310
   <para>
311
    <programlisting role="php">
312
    <![CDATA[
313
/**
314
 * Simple DocBlock with simple lists
315
 *
316
 * Here's a simple list:
317
 * - item 1
318
 * - item 2, this one
319
 *   is multi-line
320
 * - item 3
321
 * end of list.  Next list is ordered
322
 * 1 ordered item 1
323
 * 2 ordered item 2
324
 * end of list. This is also ordered:
325
 * 1. ordered item 1
326
 * 2. ordered item 2
327
 */
328
    ]]>
329
    </programlisting>
330
   </para>
331
   <para>phpDocumentor recognizes any simple list that begins with &quot;-&quot;,
332
    &quot;+&quot;, &quot;#&quot; and &quot;o&quot;, and any ordered list with
333
    sequential numbers or numbers followed by &quot;.&quot; as above.  The list
334
    delimiter must be followed by a space (not a tab!) and whitespace must line
335
    up exactly, or phpDocumentor will not recognize the list items as being in
336
    the same list.
337
   </para>
338
   <para>
339
    <programlisting role="php">
340
    <![CDATA[
341
/**
342
 * Simple DocBlock with screwy lists
343
 *
344
 * +not a list at all, no space
345
 * Here's 3 lists!
346
 * - item 1
347
 *  - item 2, this one
348
 *   is multi-line
349
 *- item 3
350
 */
351
    ]]>
352
    </programlisting>
353
   </para>
354
   <para>Again, you must line up the list iterators in the same vertical column
355
     in order for those list items to be considered &quot;on the same list&quot;.
356
     Also, you cannot create nested lists using the simple list iterators...
357
     doing so means it's no longer a &quot;simple&quot; list!  Varying the spacing
358
     of the list iterators does not create nesting of the lists... it only starts up
359
     new simple lists.  If you specifically need a nested list, you must use the list
360
     tags (&lt;ol&gt;, &lt;ul&gt;):
361
   </para>
362
   <para>
363
    <programlisting role="php">
364
    <![CDATA[
365
/**
366
 * DocBlock with nested lists
367
 *
368
 * Here's the "complex" list:
369
 * <ul>
370
 * <li>outer item 1</li>
371
 * <li>outer item 2, this one
372
 *   is multi-line</li>
373
 * <li>item 3 is a nested inner list
374
 * <ul>
375
 * <li>inner item 1</li>
376
 * <li>inner item 2</li>
377
 * </ul>
378
 * <li>outer item 4</li>
379
 * </ul>
380
 */
381
    ]]>
382
    </programlisting>
383
   </para>
384
   <para>In some cases, the text description in a doc tag can contain a list, be it simple
385
     or complex.  Notice that a title line is needed, with the list items themselves
386
     beginning on the next line:
387
   </para>
388
   <para>
389
    <programlisting role="php">
390
    <![CDATA[
391
/**
392
 * DocBlock with nested lists
393
 * in the tag descriptions
394
 * @todo My Simple TODO List
395
 *    - item 1
396
 *    - item 2
397
 *    - item 3
398
 * @todo My Complex TODO List
399
 *    <ol>
400
 *      <li>item 1.0</li>
401
 *      <li>item 2.0</li>
402
 *      <li>item 3.0</li>
403
 *        <ol>
404
 *          <li>item 3.1</li>
405
 *          <li>item 3.2</li>
406
 *        </ol>
407
 *      <li>item 4.0</li>
408
 *    </ol>
409
 */
410
    ]]>
411
    </programlisting>
412
   </para>
413
   <para>Tagged lists are always a more robust and predictable option for you to
414
     use.  Simple lists are convenient, but if you find yourself trying to bend
415
     a simple list into displaying a certain way in your generated docs, you may
416
     be better served by switching to a tagged list instead.
417
   </para>
418
   <para>For in-depth information on how phpDocumentor parses the description
419
    field, see {@link ParserDescCleanup.inc}
420
   </para>
421
  </refsect2>
422
  <refsect2 id="{@id docblocktemplate}">
423
   <title>DocBlock Templates</title>
424
   <para>New for version 1.2.0, phpDocumentor supports the use of DocBlock
425
    templates.  The purpose of a DocBlock template is to reduce redundant
426
    typing.  For instance, if a large number of class variables are private,
427
    one would use a DocBlock template to mark them as private.  DocBlock templates
428
    simply augment any normal DocBlocks found in the template block.
429
   </para>
430
   <para>A DocBlock template is distinguished from a normal DocBlock by its header.
431
    Here is the most basic DocBlock template:
432
   </para>
433
   <para>
434
    <programlisting role="php">
435
     <![CDATA[
436
/**#@+
437
 *
438
 */
439
     ]]>
440
    </programlisting>
441
   </para>
442
   <para>The text that marks this as a DocBlock template is &quot;/**#@+&quot;
443
    - all 6 characters must be present.  DocBlock templates are applied to all
444
    documentable elements until the ending template marker:
445
   </para>
446
   <para>
447
    <programlisting role="php">
448
     <![CDATA[
449
/**#@-*/
450
     ]]>
451
    </programlisting>
452
   </para>
453
   <para>Note that all 8 characters must appear as &quot;/**#@-*/&quot; in order
454
    for phpDocumentor to recognize them as a template.  Here is an example of a
455
    DocBlock template in action:
456
   </para>
457
   <para>
458
    <programlisting role="php">
459
    <![CDATA[
460
class Bob
461
{
462
    // beginning of docblock template area
463
    /**#@+
464
     * @access private
465
     * @var string
466
     */
467
    var $_var1 = 'hello';
468
    var $_var2 = 'my';
469
    var $_var3 = 'name';
470
    var $_var4 = 'is';
471
    var $_var5 = 'Bob';
472
    var $_var6 = 'and';
473
    var $_var7 = 'I';
474
    /**
475
     * Two words
476
     */
477
    var $_var8 = 'like strings';
478
    /**#@-*/
479
    var $publicvar = 'Lookee me!';
480
}
481
    ]]>
482
    </programlisting>
483
   </para>
484
   <para>This example will parse as if it were:</para>
485
   <para>
486
    <programlisting role="php">
487
    <![CDATA[
488
class Bob
489
{
490
    // beginning of docblock template area
491
    /**
492
     * @access private
493
     * @var string
494
     */
495
    var $_var1 = 'hello';
496
    /**
497
     * @access private
498
     * @var string
499
     */
500
    var $_var2 = 'my';
501
    /**
502
     * @access private
503
     * @var string
504
     */
505
    var $_var3 = 'name';
506
    /**
507
     * @access private
508
     * @var string
509
     */
510
    var $_var4 = 'is';
511
    /**
512
     * @access private
513
     * @var string
514
     */
515
    var $_var5 = 'Bob';
516
    /**
517
     * @access private
518
     * @var string
519
     */
520
    var $_var6 = 'and';
521
    /**
522
     * @access private
523
     * @var string
524
     */
525
    var $_var7 = 'I';
526
    /**
527
     * Two words
528
     * @access private
529
     * @var string
530
     */
531
    var $_var8 = 'like strings';
532
    var $publicvar = 'Lookee me!';
533
}
534
    ]]>
535
    </programlisting>
536
   </para>
537
   <para>Note that for <varname>$_var8</varname> the DocBlock template merged
538
    with the DocBlock.  The rules for merging are simple:
539
    <itemizedlist>
540
     <listitem><para>The long description of the docblock template is added to
541
      the front of the long description.  The short description is ignored.
542
     </para></listitem>
543
     <listitem><para>All tags are merged from the docblock template</para></listitem>
544
    </itemizedlist>
545
   </para>
546
  </refsect2>
547
  <refsect2 id="{@id tags}">
548
   <title>Tags</title>
549
   <para>Tags are single words prefixed by a &quot;@&quot; symbol.  Tags inform
550
    phpDocumentor how to present information and modify display of documentation.
551
    All tags are optional, but if you use a tag, they do have specific requirements
552
    to parse properly.
553
   </para>
554
   <para>A list of all possible tags in phpDocumentor follows:</para>
555
   <para>
556
    <programlisting role="php">
557
    <![CDATA[
558
/**
559
 * The short description
560
 *
561
 * As many lines of extendend description as you want {@}link element}
562
 * links to an element
563
 * {@}link http://www.example.com Example hyperlink inline link} links to
564
 * a website. The inline
565
 * source tag displays function source code in the description:
566
 * {@}source}
567
 *
568
 * In addition, in version 1.2+ one can link to extended documentation like this
569
 * documentation using {@}tutorial phpDocumentor/phpDocumentor.howto.pkg}
570
 * In a method/class var, {@}inheritdoc may be used to copy documentation from
571
 * the parent method
572
 * {@internal
573
 * This paragraph explains very detailed information that will only
574
 * be of use to advanced developers, and can contain
575
 * {@}link http://www.example.com Other inline links!} as well as text}}
576
 *
577
 * Here are the tags:
578
 *
579
 * @abstract
580
 * @access       public or private
581
 * @author       author name <author@email>
582
 * @copyright    name date
583
 * @deprecated   description
584
 * @deprec       alias for deprecated
585
 * @example      /path/to/example
586
 * @exception    Javadoc-compatible, use as needed
587
 * @global       type $globalvarname
588
   or
589
 * @global       type description of global variable usage in a function
590
 * @ignore
591
 * @internal     private information for advanced developers only
592
 * @param        type [$varname] description
593
 * @return       type description
594
 * @link         URL
595
 * @name         procpagealias
596
   or
597
 * @name         $globalvaralias
598
 * @magic        phpdoc.de compatibility
599
 * @package      package name
600
 * @see          name of another element that can be documented,
601
 *               produces a link to it in the documentation
602
 * @since        a version or a date
603
 * @static
604
 * @staticvar    type description of static variable usage in a function
605
 * @subpackage	sub package name, groupings inside of a project
606
 * @throws       Javadoc-compatible, use as needed
607
 * @todo         phpdoc.de compatibility
608
 * @var		type	a data type for a class variable
609
 * @version	version
610
 */
611
function if_there_is_an_inline_source_tag_this_must_be_a_function()
612
{
613
// ...
614
}
615
    ]]>
616
    </programlisting>
617
   </para>
618
   <para>In addition, tutorials allow two addition inline tags: {@}id}, used to
619
    allow direct linking to sections in a tutorial, and {@}toc}, used to generate
620
    a table of contents from {@}id}s in the file.  Think of {@}id} like an &lt;a
621
    name=&quot;idname&quot;&gt; HTML tag, it serves the same function.
622
   </para>
623
   <para>See {@tutorial tags.inlineid.pkg} and {@tutorial tags.inlinetoc.pkg} for
624
    detailed information
625
   </para>
626
   <para>In the example below, {@}id} is used to name the refsect1 "mysection"
627
    and the refsect2 "mysection.mysubsection" - note that the sub-sections inherit
628
    the parent section's id.
629
   </para>
630
   <para>
631
    <example role="xml">
632
    <![CDATA[
633
<refentry id="{@}id}">
634
 <refsect1 id="{@}id mysection}">
635
  <refsect2 id="{@}id mysubsection}">
636
  </refsect2>
637
 </refsect1>
638
</refentry>
639
    ]]>
640
    </example>
641
   </para>
642
   <para>For an in-depth look at phpDocumentor tags, read {@tutorial tags.pkg},
643
    and for an in-depth look at inline tags, read {@tutorial inlinetags.pkg}.
644
   </para>
645
  </refsect2>
646
 </refsect1>
647
 <refsect1 id="{@id documenting}">
648
  <title>Documenting your PHP project</title>
649
  <refsect2 id="{@id intro}">
650
   <title>Where to begin</title>
651
   <para>Before you begin documenting your PHP project, you might want to try
652
    a test run on your undocumented source code to see what kind of information
653
    phpDocumentor will automatically extract from the source code.  phpDocumentor
654
    is designed to make the task of documenting minimally redundant.  This means
655
    less work, and better, up-to-date documentation with less effort than it used
656
    to take.
657
   </para>
658
   <caution>phpDocumentor is a great tool, but it will not write good documentation
659
    for you.  Please read the {@tutorial phpDocumentor.pkg}
660
   </caution>
661
  </refsect2>
662
  <refsect2 id="{@id elements}">
663
   <title>Elements of the source code that can be documented</title>
664
   <refsect3 id="{@id packages}">
665
    <title>Dividing projects into packages</title>
666
    <para>To understand the role of packages and how to use {@tutorial tags.package.pkg},
667
     it is important to know the logic behind packaging in PHP.  The quest for structured
668
     programming led to the invention of functions, then classes, and finally packages.
669
     Traditionally, a re-usable software module was a collection of variables, constants
670
     and functions that could be used by another software package.  PHP is an example of
671
     this model, as their are many extensions that consist of constants and functions like
672
     the tokenizer extension.  One can think of the tokenizer extension as a package: it
673
     is a complete set of data, variables and functions that can be used in other programs.
674
     A more structured format of this model is of course objects, or classes.  A class
675
     contains variables and functions (but no constants in PHP).  A single class packages
676
     together related functions and variables to be re-used.
677
    </para>
678
    <para>phpDocumentor defines package in two ways:
679
     <orderedlist>
680
      <listitem><para>Functions, Constants and Global Variables are grouped into files
681
       (by the filesystem), which are in turn grouped into packages using the @package
682
       tag in a page-level DocBlock
683
      </para></listitem>
684
      <listitem><para>Methods and Class Variables are grouped into classes (by PH),
685
       which are in turn grouped into packages in a Class DocBlock
686
      </para></listitem>
687
     </orderedlist>
688
     These two definitions of package are exclusive.  In other words, it is possible
689
     to have classes of a different package of the file that contains it!  Here's an example:
690
    </para>
691
    <caution>It may be possible, but don't put classes into a different package from the
692
     file they reside in, that will be very confusing and unnecessary.  This behavior is
693
     deprecated, in version 2.0, phpDocumentor will halt parsing upon this condition.
694
    </caution>
695
    <para>
696
     <programlisting role="php">
697
     <![CDATA[
698
<?php
699
/**
700
 * Pretend this is a file
701
 *
702
 * Page-level DocBlock is here because it is the first DocBlock
703
 * in the file, and is immediately followed by the second
704
 * DocBlock before any documentable element is declared
705
 * (function, define, class, global variable, include)
706
 * @package pagepackage
707
 */
708
/**
709
 * Here is the class DocBlock
710
 *
711
 * The class package is different from the page package!
712
 * @package classpackage
713
 */
714
class myclass
715
{
716
}
717
?>
718
     ]]>
719
     </programlisting>
720
    </para>
721
    <para>For more information on page-level versus class-level packaging, see {@tutorial elements.pkg#procedural}</para>
722
    <para>Perhaps the best way to organize packages is to put all procedural code
723
     into separate files from classes.  {@link http://pear.php.net PEAR} recommends
724
     putting every class into a separate file.  For small, utility classes, this may
725
     not be the best solution for all cases, but it is still best to separate packages
726
     into different files for consistency.
727
    </para>
728
   </refsect3>
729
  </refsect2>
730
  <refsect2 id="{@id tutorials}">
731
   <title>Advanced phpDocumentor: tutorials and extended Documentation</title>
732
   <para>phpDocumentor developers have received a number of requests to allow linking
733
    to external documentation, and to sections of that documentation.  If phpDocumentor
734
    only could create HTML documents, this would be a simple task, but the presence of
735
    PDF and now XML converters as well as future possibilities complicates this question
736
    tremendously.  What is the solution?
737
   </para>
738
   <para>Give phpDocumentor the ability to parse external documentation in a common format
739
    and then convert it to the appropriate format for each converter.  The implementation
740
    of this solution in version 1.2.0 is very versatile.  Making use of the standard DocBook
741
    XML format, external documentation can be designed and then reformatted for any output.
742
    No longer is external documentation tied down to one &quot;look.&quot;  Here's a short
743
    list of the benefits of this approach:
744
   </para>
745
   <para>
746
    Benefits of using DocBook as the format:
747
    <itemizedlist>
748
     <listitem><para>DocBook is very similar to HTML at the basic level and very
749
      easy to learn.
750
     </para></listitem>
751
     <listitem><para>Each template has its own options.ini file which determines
752
      how the DocBook tags will be translated into the output language - no need
753
      to learn xslt.
754
     </para></listitem>
755
     <listitem><para>Adding in xslt support will be very easy to allow for future
756
      customization
757
     </para></listitem>
758
    </itemizedlist>
759
    Benefits of integrating tutorials/external documentation into phpDocumentor:
760
    <itemizedlist>
761
     <listitem><para>Linking to external documentation from within API docs is possible</para></listitem>
762
     <listitem><para>Linking to API docs from external documentation is also possible</para></listitem>
763
     <listitem><para>Customizable table of contents, both of all tutorials and within
764
      a tutorial via {@tutorial tags.inlinetoc.pkg}
765
     </para></listitem>
766
     <listitem><para>It is possible to create User-level documentation that has direct
767
      access to Programmer-level documentation
768
     </para></listitem>
769
    </itemizedlist>
770
   </para>
771
   <para>User-level documentation generally consists of tutorials and information on how
772
    to use a package, and avoids extreme detail.  On the other hand, programmer-level
773
    documentation has all the details a programmer needs to extend and modify a package.
774
    phpDocumentor has been assisting the creation of programmer-level documentation since
775
    its inception.  With the addition of tutorials, it can now ease the creation of user-level
776
    documentation.
777
   </para>
778
   <para>For an in-depth look at how to use tutorials, read {@tutorial tutorials.pkg}</para>
779
  </refsect2>
780
 </refsect1>
781
 <refsect1 id="{@id using}">
782
  <title>Running phpDocumentor</title>
783
  <para>There are two bundled ways of invoking phpDocumentor, the command-line phpdoc,
784
   or the web interface phpdoc.php/new_phpdoc.php.
785
  </para>
786
  <refsect2 id="{@id docbuilder}">
787
   <title>Using the new Web Interface docbuilder</title>
788
   <para>The new web interface requires a working installation of PHP with a web server,
789
    and must be accessible from the document root.  Docbuilder is the creation of Andrew
790
    Eddies, and it combines some slick formatting with the functionality of the old web
791
    interface.  The docbuilder interface can be accessed via index.html in the install
792
    directory of phpDocumentor, or the docbuilder subdirectory.
793
   </para>
794
  </refsect2>
795
  <refsect2 id="{@id web}">
796
   <title>Using the old Web Interface {@link phpdoc.php} or {@link new_phpdoc.php}</title>
797
   <para>In order to use the web interface, there are a number of factors that must
798
    be set up before anything else can occur.  First, you need a working web server
799
    with php (it had to be said).  This manual will not assist with that setup.  Next,
800
    the phpdoc.php or new_phpdoc.php file needs to be accessible by the webserver.  In
801
    unix, place a symbolic link using ln -s to the desired interface into the public
802
    html directory.
803
   </para>
804
   <caution>Security is always an issue with the internet.  Do not place phpDocumentor
805
    into the web server publicly available path on a server connected to the internet.
806
    Make sure that phpDocumentor will not have the power to overwrite <emphasis>ANY</emphasis>
807
    system or user files.
808
   </caution>
809
   <para>Note that since the webserver runs as user nobody in unix, the generated files
810
    will be owned by nobody.  The only way to change this is to either run phpDocumentor
811
    from the command-line or to add a chuser wrapper around httpd.  <emphasis>We do not
812
    recommend using a chuser wrapper or running phpDocumentor as root.</emphasis>  It is
813
    much easier and safer to use a config file (see {@tutorial phpDocumentor.howto.pkg#using.config-files})
814
    from the command line.
815
   </para>
816
  </refsect2>
817
  <refsect2 id="{@id command-line}">
818
   <title>Using the Command-line tool</title>
819
   <refsect3 id="{@id windows}">
820
    <title>Running the command-line in MS Windows</title>
821
    <para>Running phpDocumentor from the command-line is fairly straightforward, even in
822
     windows.  It is recommended to use the web interface in windows, from a non-publicly
823
     accessible server root, as none of the permissions issues exist that exist in unix.
824
     However, to use phpDocumentor from the command line is possible.  First, put the
825
     location of php into the system path, then type:
826
    </para>
827
    <para>
828
     <screen>
829
<![CDATA[
830
C:\>php-cli C:\path\to\phpdoc\phpdoc [commandline]
831
]]>
832
     </screen>
833
    </para>
834
    <para>An alternative is to edit the phpdoc.bat file, and place phpdoc in the path,
835
     then you can run phpdoc as a normal command.
836
    </para>
837
   </refsect3>
838
   <refsect3 id="{@id unix}">
839
    <title>Running the command-line in unix</title>
840
    <para>Running the command-line tool phpdoc is very easy in unix:</para>
841
     <screen>
842
<![CDATA[
843
.\phpdoc [commandline]
844
]]>
845
     </screen>
846
   </refsect3>
847
   <table frame="all" id="{@id summary}">
848
    <tgroup cols="3">
849
     <thead align="center">
850
      <row>
851
       <entry morerows="2">
852
        <emphasis>Command-line switches</emphasis>
853
       </entry>
854
      </row>
855
     </thead>
856
    <tbody>
857
     <row>
858
      <entry>-cp</entry>
859
      <entry>--converterparams</entry>
860
      <entry>dynamic parameters for a converter, separate values with commas</entry>
861
     </row>
862
     <row>
863
      <entry>-ct</entry>
864
      <entry>--customtags</entry>
865
      <entry>comma-separated list of non-standard @tags to pass to the converter as valid tags</entry>
866
     </row>
867
     <row>
868
      <entry>-d</entry>
869
      <entry>--directory</entry>
870
      <entry>name of a directory(s) to parse directory1,directory2</entry>
871
     </row>
872
  	 <row>
873
      <entry>-dc</entry>
874
      <entry>--defaultcategoryname</entry>
875
      <entry>name to use for the default category.  If not specified, uses 'default'</entry>
876
     </row>
877
     <row>
878
      <entry>-dh</entry>
879
      <entry>--hidden</entry>
880
      <entry>set equal to on (-dh on) to descend into hidden directories (directories
881
       starting with '.'), default is off
882
      </entry>
883
     </row>
884
  	 <row>
885
      <entry>-dn</entry>
886
      <entry>--defaultpackagename</entry>
887
      <entry>name to use for the default package.  If not specified, uses 'default'</entry>
888
     </row>
889
     <row>
890
      <entry>-ed</entry>
891
      <entry>--examplesdir</entry>
892
      <entry>full path of the directory to look for example files from @example tags</entry>
893
     </row>
894
     <row>
895
      <entry>-f</entry>
896
      <entry>--filename</entry>
897
      <entry>name of file(s) to parse ',' file1,file2.  Can contain complete path and * ? wildcards</entry>
898
     </row>
899
     <row>
900
      <entry>-i</entry>
901
      <entry>--ignore</entry>
902
      <entry>file(s) that will be ignored, multiple separated by ','.  Wildcards * and ? are ok</entry>
903
     </row>
904
     <row>
905
      <entry>-is</entry>
906
      <entry>--ignoresymlinks</entry>
907
      <entry>Explicitly ignore symlinks, both symlinked directories and symlinked files.
908
      Valid options are &quot;on&quot; and &quot;offn&quot; default value is &quot;off&quot;</entry>
909
     </row>
910
     <row>
911
      <entry>-it</entry>
912
      <entry>--ignore-tags</entry>
913
      <entry>tags to ignore for this parse.  @package, @subpackage, @access and @ignore may not be ignored.</entry>
914
     </row>
915
     <row>
916
      <entry>-j</entry>
917
      <entry>--javadocdesc</entry>
918
      <entry>use JavaDoc-compliant description (short desc is part of description, and is everything up to first .)</entry>
919
     </row>
920
     <row>
921
      <entry>-o</entry>
922
      <entry>--output</entry>
923
      <entry>output information, format:converter:template (HTML:frames:phpedit for example)</entry>
924
     </row>
925
     <row>
926
      <entry>-p</entry>
927
      <entry>--pear</entry>
928
      <entry>Parse a PEAR-style repository (package is directory, _members are @access private) on/off default off</entry>
929
     </row>
930
     <row>
931
      <entry>-po</entry>
932
      <entry>--packageoutput</entry>
933
      <entry>output documentation only for selected packages.  Use a comma-delimited list</entry>
934
     </row>
935
     <row>
936
      <entry>-pp</entry>
937
      <entry>--parseprivate</entry>
938
      <entry>parse elements marked private with @access.  Valid options are &quot;on&quot;
939
       and &quot;off&quot; default value is &quot;off&quot;
940
      </entry>
941
     </row>
942
     <row>
943
      <entry>-q</entry>
944
      <entry>--quiet</entry>
945
      <entry>do not display parsing/conversion messages.  Useful for cron jobs.  Valid options are &quot;on&quot;
946
       and &quot;off&quot; default value is &quot;off&quot;</entry>
947
     </row>
948
     <row>
949
      <entry>-ric</entry>
950
      <entry>--readmeinstallchangelog</entry>
951
      <entry>Specify custom filenames to parse like README, INSTALL or CHANGELOG files</entry>
952
     </row>
953
     <row>
954
      <entry>-s</entry>
955
      <entry>--sourcecode</entry>
956
      <entry>generate highlighted sourcecode for every parsed file (PHP 4.3.0+ only) on/off default off</entry>
957
     </row>
958
     <row>
959
      <entry>-t</entry>
960
      <entry>--target</entry>
961
      <entry>path where to save the generated files</entry>
962
     </row>
963
     <row>
964
      <entry>-ti</entry>
965
      <entry>--title</entry>
966
      <entry>title of generated documentation, default is 'Generated Documentation'</entry>
967
     </row>
968
     <row>
969
      <entry>-tb</entry>
970
      <entry>--templatebase</entry>
971
      <entry>base location of all templates for this parse.  Note that if -tb /path/to/here, then
972
       templates for HTML:frames:default must be in /path/to/here/Converters/HTML/frames/templates/default/templates
973
       and the /path/to/here/Converters/HTML/frames/templates/default/templates_c directory must
974
       exist, or Smarty will bail on attempting to compile the templates.
975
      </entry>
976
     </row>
977
     <row>
978
      <entry>-ue</entry>
979
      <entry>--undocumentedelements</entry>
980
      <entry>Enable warnings for undocumented elements. Useful for identifying classes and methods that haven't yet been documented.
981
      Valid options are &quot;on&quot; and &quot;offn&quot; default value is &quot;off&quot;</entry>
982
     </row>
983
    </tbody>
984
    </tgroup>
985
   </table>
986
   <refsect3 id="{@id config}">
987
    <title>-c, --config</title>
988
    <para>Use this option to load a config file (see {@tutorial phpDocumentor.howto.pkg#using.config-files})</para>
989
    <para>&quot;phpdoc -c default&quot; will load the default.ini file</para>
990
   </refsect3>
991
   <refsect3 id="{@id converterparams}">
992
    <title>-cp, --converterparams</title>
993
    <para>This option is only used to pass dynamic parameters to extended converters.  The options
994
     passed should be separated by commas, and are placed in the global variable
995
     <varname>$_phpDocumentor_setting['converterparams']</varname>, an array.  It is the
996
     responsibility of the Converter to access this variable, the code included with phpDocumentor
997
     does nothing with it.
998
    </para>
999
   </refsect3>
1000
   <refsect3 id="{@id customtags}">
1001
    <title>-ct, --customtags</title>
1002
    <para>Use this option to specify tags that should be included in the list of valid tags for
1003
     the current run of phpdoc
1004
    </para>
1005
    <para>&quot;phpdoc -ct mytag,anothertag&quot; will tell phpDocumentor to parse this DocBlock:</para>
1006
    <para>
1007
     <programlisting role="php">
1008
     <![CDATA[
1009
/**
1010
 * @mytag this is my tag
1011
 * @anothertag this is another tag
1012
 */
1013
     ]]>
1014
     </programlisting>
1015
    </para>
1016
    <para>without raising any errors, and include the tags in the known tags list for the
1017
     template to handle.  Note that in version 1.2.0+, the unknown_tags array is passed to templates.
1018
    </para>
1019
   </refsect3>
1020
   <refsect3 id="{@id hidden}">
1021
    <title>-dh, --hidden</title>
1022
    <para>Use this option to tell phpDocumentor to parse files and directories that begin with a period (.)</para>
1023
   </refsect3>
1024
   <refsect3 id="{@id defaultcategoryname}">
1025
    <title>-dc, --defaultcategoryname</title>
1026
    <para>This will tell phpDocumentor to group any uncategorized elements into the primary
1027
     categoryname.  If not specified, the primary category is &quot;default.&quot;  The
1028
     category should be specified using the {@tutorial tags.category.pkg} tag.
1029
    </para>
1030
    <para>
1031
     <programlisting role="php">
1032
     <![CDATA[
1033
/**
1034
 * This package has no category and will be grouped into the default
1035
 * category unless -dc categoryname is used
1036
 * @package mypackage
1037
 */
1038
class nocategory
1039
{
1040
}
1041
     ]]>
1042
     </programlisting>
1043
    </para>
1044
   </refsect3>
1045
   <refsect3 id="{@id defaultpackagename}">
1046
    <title>-dn, --defaultpackagename</title>
1047
    <para>Use this option to tell phpDocumentor what the primary package's name is.  This will also tell phpDocumentor to group any unpackaged elements into the primary packagename.  If not specified, the primary package is &quot;default&quot;</para>
1048
    <para>
1049
     <programlisting role="php">
1050
     <![CDATA[
1051
/**
1052
 * This class has no package and will be grouped into the default
1053
 * package unless -dn packagename is used
1054
 */
1055
class nopackage
1056
{
1057
}
1058
     ]]>
1059
     </programlisting>
1060
    </para>
1061
   </refsect3>
1062
   <refsect3 id="{@id directory}">
1063
    <title>-d, --directory</title>
1064
    <para>This or the -f option must be present, either on the command-line or in the config file.</para>
1065
    <para>Unlike -f, -d does not accept wildcards.  Use -d to specify full paths or relative paths to the current directory that phpDocumentor should recursively search for documentable files.  phpDocumentor will search through all subdirectories of any directory in the command-line list for tutorials/ and any files that have valid .php extensions as defined in phpDocumentor.ini.  For example:</para>
1066
    <para>&quot;phpdoc -d relative/path/to/dir1,/fullpath/to/here,..&quot;</para>
1067
   </refsect3>
1068
   <refsect3 id="{@id examplesdir}">
1069
    <title>-ed, --examplesdir</title>
1070
    <para>The -ed option is used to specify the full path to a directory that example files are located in.  This command-line setting affects the output of the {@tutorial tags.example.pkg} tag.</para>
1071
    <para>&quot;phpdoc -ed /fullpath/to/examples&quot;</para>
1072
   </refsect3>
1073
   <refsect3 id="{@id filename}">
1074
    <title>-f, --filename</title>
1075
    <para>This or the -d option must be present, either on the command-line or in the config file.</para>
1076
    <para>This option is used to specify individual files or expressions with wildcards * and ?.  Use * to match any string, and ? to match any single character.</para>
1077
    <para>
1078
     <itemizedlist>
1079
      <listitem><para>phpdoc -f m*.p* will match myfile.php, mary_who.isthat.phtml, etc.</para></listitem>
1080
      <listitem><para>phpdoc -f /path/m* will match /path/my/files/here.php, /path/mommy.php /path/mucho/grande/what.doc, etc.</para></listitem>
1081
      <listitem><para>phpdoc -f file?.php will match file1.php, file2.php and will not match file10.php</para></listitem>
1082
     </itemizedlist>
1083
    </para>
1084
   </refsect3>
1085
   <refsect3 id="{@id ignore}">
1086
    <title>-i, --ignore</title>
1087
    <para>Use the -i option to exclude files and directories from parsing.  The -i option recognizes the * and ? wildcards, like -f does.  In addition, it is possible to ignore a subdirectory of any directory using &quot;dirname/&quot;.</para>
1088
    <para>
1089
     <itemizedlist>
1090
      <listitem><para>phpdoc -i tests/ will ignore /path/to/here/tests/* and /path/tests/*</para></listitem>
1091
      <listitem><para>phpdoc -i *.inc will ignore all .inc files</para></listitem>
1092
      <listitem><para>phpdoc -i *path/to/* will ignore /path/path/to/my/* as well as /path/to/*</para></listitem>
1093
      <listitem><para>phpdoc -i *test* will ignore /path/tests/* and /path/here/my_test.php</para></listitem>
1094
     </itemizedlist>
1095
    </para>
1096
    <para>Since v1.3.2, the value or pattern you provide will be case-sensitive (OS permitting, anyway), and will be applied relative to the top-level directory in the -d argument.</para>
1097
    <para>
1098
     <itemizedlist>
1099
      <listitem><para>phpdoc -i CVS/ will ignore /path/to/CVS/* but will not ignore /path/to/cvs</para></listitem>
1100
      <listitem><para>phpdoc -d /home/myhome/cvs/myproject -i cvs/ will ignore /home/myhome/cvs/myproject/files/cvs/* but will not ignore /home/myhome/cvs/*</para></listitem>
1101
     </itemizedlist>
1102
    </para>
1103
   </refsect3>
1104
   <refsect3 id="{@id ignore-symlinks}">
1105
    <title>-is, --ignoresymlinks</title>
1106
    <para>Use the -is option to explicitly ignore any symlinks, whether they be links to directories or links to files.</para>
1107
	<para>This only works on a Unix/Linux environment, since Windows doesn't have symlinks.</para>
1108
   </refsect3>
1109
   <refsect3 id="{@id ignore-tags}">
1110
    <title>-it, --ignore-tags</title>
1111
    <para>Use the -it option to exclude specific tags from output.  This is used for creating multiple sets of documentation for different audiences.  For instance, to generate documentation for end-users, it may not be desired to output all @todo tags, so --ignore-tags @todo would be used.  To ignore inline tags, surround them with brackets {} like --ignore-tags {@internal}.</para>
1112
    <para>--ignore-tags will not ignore the core tags @global, @access, @package, @ignore, @name, @param, @return, @staticvar or @var.</para>
1113
    <caution>The --ignore-tags option requires a full tag name like --ignore-tags @todo.  --ignore-tags todo will not work.</caution>
1114
   </refsect3>
1115
   <refsect3 id="{@id javadocdesc}">
1116
    <title>-j, --javadocdesc</title>
1117
    <para>Use this command-line option to enforce strict compliance with JavaDoc.  JavaDoc DocBlocks are much less flexible than phpDocumentor's DocBlocks (see {@tutorial phpDocumentor.howto.pkg#basics.docblock} for information).</para>
1118
   </refsect3>
1119
   <refsect3 id="{@id output}">
1120
    <title>-o, --output</title>
1121
    <para>Use this required option to tell phpDocumentor which Converters and templates to use.  In this release, there are several choices:
1122
     <itemizedlist>
1123
      <listitem><para>HTML:frames:* - output is HTML with frames.
1124
       <itemizedlist>
1125
        <listitem><para>HTML:frames:default - JavaDoc-like template, very plain, minimal formatting</para></listitem>
1126
        <listitem><para>HTML:frames:earthli - BEAUTIFUL template written by Marco von Ballmoos</para></listitem>
1127
        <listitem><para>HTML:frames:l0l33t - Stylish template</para></listitem>
1128
        <listitem><para>HTML:frames:phpdoc.de - Similar to phpdoc.de's PHPDoc output</para></listitem>
1129
        <listitem><para>HTML:frames:phphtmllib - Very nice user-contributed template</para></listitem>
1130
        <listitem><para>all of the templates listed above are also available with javascripted expandable indexes, as HTML:frames:DOM/name where name is default, l0l33t, phpdoc.de, etcetera</para></listitem>
1131
        <listitem><para>HTML:frames:phpedit - Based on output from {@link http://www.phpedit.net PHPEdit} Help Generator</para></listitem>
1132
       </itemizedlist>
1133
      </para></listitem>
1134
      <listitem><para>HTML:Smarty:* - output is HTML with no frames.
1135
       <itemizedlist>
1136
        <listitem><para>HTML:Smarty:default - Bold template design using css to control layout</para></listitem>
1137
        <listitem><para>HTML:Smarty:HandS - Layout is based on PHP, but more refined, with logo image</para></listitem>
1138
        <listitem><para>HTML:Smarty:PHP - Layout is identical to the PHP website</para></listitem>
1139
       </itemizedlist>
1140
      </para></listitem>
1141
      <listitem><para>CHM:default:* - output is CHM, compiled help file format (Windows help).
1142
       <itemizedlist>
1143
        <listitem><para>CHM:default:default - Windows help file, based on HTML:frames:l0l33t</para></listitem>
1144
       </itemizedlist>
1145
      </para></listitem>
1146
      <listitem><para>PDF:default:* - output is PDF, Adobe Acrobat format
1147
       <itemizedlist>
1148
        <listitem><para>PDF:default:default - standard, plain PDF formatting</para></listitem>
1149
       </itemizedlist>
1150
      </para></listitem>
1151
      <listitem><para>XML:DocBook:* - output is XML, in DocBook format
1152
       <itemizedlist>
1153
        <listitem><para>XML:DocBook/peardoc2:default - documentation ready for compiling into peardoc for online pear.php.net documentation, 2nd revision</para></listitem>
1154
       </itemizedlist>
1155
      </para></listitem>
1156
     </itemizedlist>
1157
    </para>
1158
    <para>In 1.2.0+, it is possible to generate output for several converters and/or templates at once.  Simply specify a comma-delimited list of output:converter:template like:
1159
    </para>
1160
    <para>
1161
     <screen>phpdoc -o HTML:frames:default,HTML:Smarty:PHP,HTML:frames:phpedit,PDF:default:default -t ./docs -d .</screen>
1162
    </para>
1163
   </refsect3>
1164
   <refsect3 id="{@id parseprivate}">
1165
    <title>-pp, --parseprivate</title>
1166
    <para>By default, phpDocumentor does not create documentation for any elements marked {@tutorial tags.access.pkg} private.  This allows creation of end-user API docs that filter out low-level information that will not be useful to most developers using your code.  To create complete documentation of all elements, use this command-line option to turn on parsing of elements marked private with @access private.</para>
1167
   </refsect3>
1168
   <refsect3 id="{@id packageoutput}">
1169
    <title>-po, --packageoutput</title>
1170
    <para>Use this option to remove all elements grouped by {@tutorial tags.package.pkg} tags in a comma-delimited list from output.  This option is useful for projects that are not organized into separate files for each package.  Parsing speed is not affected by this option, use {@tutorial phpDocumentor.howto.pkg#using.command-line.ignore} whenever possible instead of --packageoutput.</para>
1171
    <para>
1172
     <screen>phpdoc -o HTML:frames:default -t ./docs -d . -po mypackage,thatotherpackage</screen> will only display documentation for elements marked with &quot;@package mypackage&quot; or &quot;@package thatotherpackage&quot;
1173
    </para>
1174
   </refsect3>
1175
   <refsect3 id="{@id pear}">
1176
    <title>-p, --pear</title>
1177
    <para>Use this option to parse a {@link http://pear.php.net PEAR}-style repository.  phpDocumentor will do several &quot;smart&quot; things to make life easier:
1178
     <itemizedlist>
1179
      <listitem><para>PEAR-style destructors are automatically parsed</para></listitem>
1180
      <listitem><para>If no @package tag is present in a file or class DocBlock, it will guess the package based on subdirectory</para></listitem>
1181
      <listitem><para>If a variable or method name begins with &quot;_&quot;, it will be assumed to be {@tutorial tags.access.pkg} private, unless an @access tag is present.  Constructors are also assumed to be @access private in the current version.</para></listitem>
1182
     </itemizedlist>
1183
     <note>
1184
      <title>@access and @package should always be explicit!</title>
1185
      <para>Warnings will be raised for every case above, as @package should always be explicit, as should @access private.  We do not like to assume that phpDocumentor knows better than you what to do with your code, and so will always require explicit usage or raise warnings if phpDocumentor does make any assumptions.</para>
1186
     </note>
1187
    </para>
1188
   </refsect3>
1189
   <refsect3 id="{@id quiet}">
1190
    <title>-q, --quiet</title>
1191
    <para>This option tells phpDocumentor to suppress output of parsing/conversion information to the console.  Use this for cron jobs or other situations where human intervention will not be needed.</para>
1192
   </refsect3>
1193
   <refsect3 id="{@id readmeinstallchangelog}">
1194
    <title>-ric, --readmeinstallchangelog</title>
1195
    <para>This comma-separated list of files specifies files that should be parsed and included in the
1196
    documentation.  phpDocumentor will automatically grab files listed here if and only if they are located
1197
    in the top-level directory that is parsed.  In other words, if you parse these files:</para>
1198
    <para>
1199
     <itemizedlist>
1200
      <listitem><simpara>/path/to/files/file1.php</simpara></listitem>
1201
      <listitem><simpara>/path/to/files/file2.php</simpara></listitem>
1202
      <listitem><simpara>/path/to/files/README</simpara></listitem>
1203
      <listitem><simpara>/path/to/files/subdir/file2.php</simpara></listitem>
1204
      <listitem><simpara>/path/to/files/subdir/README</simpara></listitem>
1205
     </itemizedlist>
1206
    </para>
1207
    <para>
1208
     The only README file that will be grabbed is /path/to/files/README, and not /path/to/files/subdir/REAMDE,
1209
     because the directory that is closest to the root directory that contains a parsed file is /path/to/files.
1210
    </para>
1211
    <para>
1212
     The default list of files is located in phpDocumentor.ini, which is found in the root installation directory
1213
     of phpDocumentor.
1214
    </para>
1215
   </refsect3>
1216
   <refsect3 id="{@id sourcecode}">
1217
    <title>-s, --sourcecode</title>
1218
    <para>This option tells phpDocumentor to generate highlighted cross-referenced source code for every file parsed.  The highlighting code is somewhat unstable, so use this option at your own risk.</para>
1219
   </refsect3>
1220
   <refsect3 id="{@id target}">
1221
    <title>-t, --target</title>
1222
    <para>Use this to tell phpDocumentor where to put generated documentation.  Legal values are paths that phpDocumentor will have write access and directory creation priveleges.</para>
1223
   </refsect3>
1224
   <refsect3 id="{@id templatebase}">
1225
    <title>-tb, --templatebase</title>
1226
    <para>-tb accepts a single pathname as its parameter.  The default value of -tb if unspecified is &lt;phpDocumentor install directory&gt;/phpDocumentor.  This raises a very important point to understand.  The -tb command-line is designed to tell phpDocumentor to look for <emphasis>all</emphasis> templates for all converters in subdirectories of the path specified.  By default, templates are located in a special subdirectory structure.</para>
1227
    <para>For the hypothetical outputformat:convertername:templatename {@tutorial phpDocumentor.howto.pkg#using.command-line.output} argument, the directory structure is Converters/outputformat/convertname/templates/templatename/.  The class file for convertname should be in the convertname/templates directly, right beside your templatename directory/ies.  In addition, Smarty expects to find two subdirectories, templates/ (containing the Smarty template files) and templates_c/ (which will contain the compiled template files).</para>
1228
    <para>&quot;phpdoc -tb ~/phpdoctemplates -o HTML:frames:default&quot; will only work if the directory ~/phpdoctemplates/Converters/HTML/frames/default/templates contains all the template files, and ~/phpdoctemplates/Converters/HTML/frames/default/templates_c exists.</para>
1229
   </refsect3>
1230
   <refsect3 id="{@id title}">
1231
    <title>-ti, --title</title>
1232
    <para>Set the global title of the generated documentation</para>
1233
   </refsect3>
1234
   <refsect3 id="{@id undocumentedelements}">
1235
    <title>-ue, --undocumentedelements</title>
1236
    <para>This option tells phpDocumentor whether or not to suppress warnings about certain objects (classes, methods) that are not documented via a DocBlock comment.  Use this to help identify objects that you still need to write documentation for.</para>
1237
   </refsect3>
1238
  </refsect2>
1239
  <refsect2 id="{@id config-files}">
1240
   <title>phpDocumentor's dynamic User-defined config files</title>
1241
   <para>The new {@tutorial phpDocumentor.howto.pkg#using.command-line.config} command-line options heralds a new era of ease in using phpDocumentor.  What used to require:</para>
1242
   <para>
1243
    <screen>
1244
    <![CDATA[
1245
phpdoc -t /path/to/output -d path/to/directory1,/another/path,/third/path\
1246
-f /path/to/anotherfile.php -i *test.php,tests/ -pp on -ti My Title -o HTML:frames:phpedit
1247
    ]]>
1248
    </screen>
1249
   </para>
1250
   <para>Can now be done in a single stroke!</para>
1251
   <para>
1252
    <screen>
1253
    <![CDATA[
1254
phpdoc -c myconfig
1255
    ]]>
1256
    </screen>
1257
   </para>
1258
   <para>What makes this all possible is the use of config files that contain all of the command-line information.  There are two configuration files included in the distribution of phpDocumentor, and both are in the user/ subdirectory.  To use a configuration file &quot;myconfig.ini,&quot; simply place it in the user directory, and the command-line &quot;phpdoc -c myconfig&quot; will tell phpDocumentor to read all the command-line settings from that config file.  Configuration files may also be placed in another directory, just specify the full path to the configuration file:</para>
1259
   <para>
1260
    <screen>
1261
    <![CDATA[
1262
phpdoc -c /full/path/to/myconfig.ini
1263
    ]]>
1264
    </screen>
1265
   </para>
1266
   <para>The best way to ensure your config file matches the format expected by phpDocumentor is to copy the default.ini config file, and modify it to match your needs.  Lines that begin with a semi-colon (;) are ignored, and can be used for comments.</para>
1267
   <note>Be sure to put in your config file all the runtime options you need, because <emphasis>all other command-line arguments are ignored</emphasis> if you use a config file.</note>
1268
  </refsect2>
1269
  <refsect2 id="{@id phpdocumentorini}">
1270
   <title>phpDocumentor.ini - global configuration options</title>
1271
   <para>The phpDocumentor.ini file contains several useful options, most of which will never need to be changed.  However, some are useful.  The section [_phpDocumentor_options] contains several configuration settings that may be changed to enhance output documentation.  For Program Location, the relative path is specified as Program_Root/relativepath/to/file.  The prefix &quot;Program_Root&quot; may be changed to any text, including none at all, or &quot;Include &quot;, etc.  The [_phpDocumentor_setting] section can be used to specify a config file that should be used by default, so phpDocumentor may be run without any command-line arguments whatsoever!  The [_phpDocumentor_phpfile_exts] section tells phpDocumentor which file extensions are php files, add any non-standard extensions, such as &quot;class&quot; to this section.</para>
1272
  </refsect2>
1273
 </refsect1>
1274
</refentry>