The CakePHP API docs allow you to build the API documentation as seen on https://api.cakephp.org
The generator requires PHP 8.2 or newer. It parses older CakePHP source code without executing it.
The tool generates documentation from CakePHP source code. According to the Makefile, you need:
- A local clone of the CakePHP repository (default location: ../cakephp/)
- Run the generator command
For example, to test with CakePHP 5.2:
cd ../cakephp/ && git checkout origin/5.x && cd -
php bin/apitool.php generate --config cakephp5 --version 5.2 --tag origin/5.x --output-dir build/test/ ../cakephp
Build the development documentation from origin/6.x:
make build-cakephp-6.0The build-cakephp6-all target builds all configured 6.x versions. The Makefile
checks out the source branch and updates its dependencies, so use a clean CakePHP
clone. Output is written to build/api/cakephp/6.0/.
To generate directly from an existing 6.x checkout:
mkdir -p build/api/cakephp/6.0
cp -r static/assets/* build/api/cakephp/6.0/
php bin/apitool.php generate --config cakephp6 --version 6.0 --tag origin/6.x --output-dir build/api/cakephp/6.0/ ../cakephpconfig/releases.php defines the versions, Git refs and dependency modes used by
Make targets. All CakePHP configurations derive their version selector from this
manifest; legacy 1.x and 2.x links are retained in config/cakephp-versions.php.
PHP is required when reading the Makefile, including for make help.
Docker uses BuildKit caches for source clones, Composer downloads and completed release documentation. Generator dependencies are installed before application sources are copied, so template edits reuse the Composer layer. Rendered releases are keyed by the source commit, generator code, templates, assets, configuration, Composer lock file, PHP major/minor version and dependency update flags. Only successful builds are cached, and a complete output directory replaces the old one.
Local Make builds can opt into the same release cache:
make build-cakephp-6.0 DOCS_CACHE_DIR="$HOME/.cache/cakephp-api-docs"Cached documentation retains its resolved source dependencies. To re-resolve them without changing the source ref, set a new refresh value:
make build-cakephp-6.0 DOCS_CACHE_DIR="$HOME/.cache/cakephp-api-docs" DOCS_CACHE_REFRESH=2026-11-29
# Also invalidates Docker's build step so remote refs are fetched again:
docker build --build-arg DOCS_CACHE_REFRESH=2026-11-29 .BuildKit caches are local to the builder. A fresh CI runner performs a full build unless its builder cache is persisted. Changing templates or shared version links correctly regenerates all affected release pages. README and test edits do not change the rendered-release cache keys.
The site-api proxy forwards public /6.0/... requests to this image's internal
/cakephp/6.0/... path. Missing HTML pages redirect to the public /6.0/ overview,
with a relative Location header so the internal prefix and upstream host do not
leak into public URLs. Missing assets retain a 404 response.
After installing Composer dependencies:
php tests/phpdoc.php
php tests/loader.php
php tests/generator.php
php tests/releases.php
sh tests/build-release.sh
# Runs nginx and HTTP requests inside a disposable container:
docker run --rm -v "$PWD:/app:ro" -w /app nginx:alpine sh tests/nginx.sh