Generate Documentation

Reference documentation for all classes and methods within a package can be automatically generated with the package gen-docs CLI command, for example:

apexdocs my-shop

Using the Apex Docs Generator, this command will automatically go through all PHP files within the /src/my-shop/ directory, and generate the necessary reference documentation, which will be saved in the /docs/MyShop/classes/ directory.

Once generated, you should update the /docs/MyShop/Readme.md file as desired, while including a link to the reference documentation. The link for which is:

https://code.apexpl.io/USERNAME/PACKAGE/trunk/docs/classes/index.md

Doc Blocks

When docs are generated, the contents of the class doc block are used as the class description. For method doc blocks, the following is gathered, all of which are optional:

  • Title is the first line of the block
  • Description is all further lines below the first.
  • @param annotations are taken into account and descriptions are placed within the parameters table.
  • @return annotations are taken into account and used as the description of the return section.

All elements are optional, but here's an example of a full doc block.

/**
 * The title of the function
 *
 * The longer description of the function, and 
 * this can contain multiple lines.
 *
 * @param string $title Title of the post
 * @param int $category The id# of the category
 * @param string $contents Contents of the post
 * 
 * @return The id# of the new post 
 */

Please note, the only thing gathered by the @param annotations is the description. The rest is automatically gathered via reflection.