apigen/apigen

PHP 7.1 source code API generator.


README

Build Status Windows Build Status Code Coverage Downloads Latest stable

Just look at CakePHP Framework or Doctrine ORM API.

Install

composer require --dev apigen/apigen

Usage

Generate API docs by passing single source and destination options:

vendor/bin/apigen generate src --destination docs

Or generate API docs for multiple directories:

vendor/bin/apigen generate src tests --destination docs

Configuration

Below is a minimal example configuration. Save it as a apigen.neon file in the root of your project:

source: [src]           # directory(-ies) to scan PHP files from
destination: docs       # destination directory to generate API docs in
visibilityLevels: [public, protected] # array
annotationGroups: [todo, deprecated] # array
title: "ApiGen Docs"
baseUrl: http://apigen.org/api
exclude: tests
extensions: [php] # array
overwrite: true # bool
templateConfig: path-to-template-config.neon # string

# templates parameters
googleAnalytics: 123

DocBlock Annotations

This section provides a list of PHP DocBlock annotations (tags) that are supported by ApiGen:

  • @deprecated - indicated that the associated element is deprecated and can be removed in the future version.
  • @internal - denotes that the associated elements is internal to this application or library and hides it by default.
  • @link - indicates a relation between the associated element and a page of a website.
  • @param - documents a single argument of a function or method.
  • @return - documents the return value of functions or methods.
  • @see - indicates a reference from the associated element to a website or other elements.
  • @uses - indicates a reference to (and from) a single associated element.

Themes

In order to enable a custom theme, you have to either provide --theme-config CLI option when runing apigen generate or add themeConfig configuration option in your ApiGen configuration file:

themeConfig: path/to/theme/config.neon # path to theme's config file

Contributing

Rules are simple:

  • new feature needs tests
  • all tests must pass
    composer complete-check
  • 1 feature per PR

We would be happy to merge your feature then.