davereid / drupal-gitlab-api-docs
Generates API docs for a Drupal module's MkDocs site with phpDocumentor, including Hooks and Events pages.
Package info
github.com/davereid/drupal-gitlab-api-docs
pkg:composer/davereid/drupal-gitlab-api-docs
Requires
- php: >=8.1
- phpdocumentor/shim: ^3.10
- saggre/phpdocumentor-markdown: ^1.0
Requires (Dev)
- phpunit/phpunit: ^10 || ^11 || ^12 || ^13
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-12-01 08:12:57 UTC
README
Generates API reference pages for a Drupal module's MkDocs site from its PHP code, with phpDocumentor and the phpdocumentor-markdown template. It works with Zensical too: it fixes the Markdown itself and needs no MkDocs plugins or hooks.
docs/api/: a page for each class, trait and interface, titled with its name, and an index.docs/hooks.md: the hooks from the module's*.api.phpfiles, when it has some.docs/events.md: the event names, the constants of classes namedEventsor*Events, with their docblocks, when it has some.
Usage
composer require --dev davereid/drupal-gitlab-api-docs
Add a docs script to the module's composer.json, with each path to document:
"scripts": { "docs": "drupal-gitlab-api-docs -d src -d mymodule.api.php" }
Run composer run docs from the module's root. It reads the module's name from its *.info.yml file and passes other options to phpdoc. Add /docs/api, /docs/hooks.md, /docs/events.md and /.phpdoc to .gitignore: the pages are generated, never committed.
Agent skill
skills/setup-docs sets up a drupal.org project's docs site, including these API docs and the GitLab CI jobs that build them. Install it with npx skills add davereid/drupal-gitlab-api-docs.