A guide is a PHP executable file that will be transformed into documentation. It follows Diataxis How-To Guides practice which is a must read before writing a guide.
Read the "How To Guide" to understand how to write an API Platform guide.
Guides are transformed to Markdown using php-documentation-generator which is merely a version of docco in PHP adapted to output markdown.
Guides are executable in a browser environment and need to be preloaded using:
docker run -v $(pwd):/src -v $(pwd)/public/php-wasm:/public -w /public php-wasm python3 /emsdk/upstream/emscripten/tools/file_packager.py php-web.data --preload "/src" --js-output=php-web.data.js --no-node --exclude '*Tests*' '*features*' '*public*' '*/.*'
A build of php-wasm is needed in the public/php-wasm
directory to try it out.
First run composer update
.
Then, get the pdg-phpunit
binary that allows to run single-file test.
Use KERNEL_CLASS
and PDG_AUTOLOAD
to run a guide:
APP_DEBUG=0 \
PDG_AUTOLOAD='vendor/autoload.php' \
KERNEL_CLASS='\ApiPlatform\Playground\Kernel' pdg-phpunit guides/doctrine-search-filter.php