@package

(PHPDocumentor 0.1+ )

@package -- Specify package to group classes or functions and defines into

Description

@package packagename

If found in a page-level DocBlock, specifies the package that all functions and defines in the php file belong to. If found in a class-level DocBlock, specifies the package that the class belongs to.

Caution

If not present, a class's package is set to default, even if the page-level package is set to another value.

@package groups php files together for documentation.

There are two ways a @package tag is parsed:

  1. page-level package (defines, functions all auto-included)
  2. class-level package (class, all its variables and methods are auto-included)

If a file contains functions and defines, they will be packaged by a page-level DocBlock. A page-level DocBlock is a DocBlock that is not paired with any PHPDocumentor element (function, define, class, class function, class variable).

PHPDocumentor parses a DocBlock as a page-level DocBlock if it precedes another DocBlock like this:

/**
* Page-Level DocBlock example.
* This DocBlock precedes another DocBlock and will be parsed as the page-level.  Put your @package and @subpackage tags here
* @package pagelevel_package
*/
/**
* function bluh
*/
function bluh()
{
...
}

A page is documented as a procedural page only if it has at least 1 function or define. PHPDocumentor will will ignore the page-level DocBlock in this example php file:

<?php
/**
* Page-Level DocBlock example.
* @package pagelevel_package_ignored
*/
/**
* class bluh
* @package classlevel_package_parsed
*/
class bluh
{
}
?>

A class-level DocBlock is any DocBlock that precedes a class definition in a php file.

<?php
/**
* class bluh
* class-level DocBlock example.
* @package applies_to_bluh
*/
class bluh
{
   /**
   * This variable is parsed as part of package applies_to_bluh
   */
   var $foo;
	
   /**
   * So is this function
   */
   function bar()
   {
   }	
}
?>

If no @package tag is specified, the package named "default" will be used.

Elements can also be grouped into subpackages using @subpackage

See also @subpackage