1. Go to this page and download the library: Download julien-boudry/php-reference library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
/**
* This class will be documented.
* @api
*/
class MyClass
{
/**
* This method will be documented.
* @api
*/
public function myMethod(): void
{
}
// This method will NOT be documented (no @api tag)
public function internalMethod(): void
{
}
}
bash
php vendor/bin/php-reference
bash
# Basic usage - generate docs for a namespace
php vendor/bin/php-reference MyNamespace\\MyProject
# With custom output directory
php vendor/bin/php-reference MyNamespace\\MyProject --output=./docs/api
# Include all public elements (not just @api tagged)
php vendor/bin/php-reference MyNamespace\\MyProject --api=IsPubliclyAccessible
# Append mode (don't clean output directory first)
php vendor/bin/php-reference MyNamespace\\MyProject --append
# With source code links
php vendor/bin/php-reference MyNamespace\\MyProject --source-url-base=https://github.com/user/repo/blob/main