ostico/phpdoc-md
Generate Markdown documentation from PHPDoc comments in your PHP project. phpdoc-md scans classes, methods, and annotations to build readable docs you can publish or include in repos. Useful for keeping API docs in sync with code.
ostico/phpdoc-md package converts PHPDoc annotations into Markdown, which is valuable for:
git push to update a docs/ folder).phpDocumentor/phpDocumentor (v3+), which may need explicit version pinning to avoid conflicts.@param, @return, @throws, etc.).@api for API-specific docs) via package configuration.| Risk Area | Mitigation Strategy |
|---|---|
| Version Conflicts | Pin phpDocumentor and ostico/phpdoc-md versions in composer.json. |
| Custom Tag Support | Extend the package via service provider or create a wrapper class. |
| Performance | Test with large codebases (e.g., 10K+ lines); may need caching (e.g., store Markdown in storage/). |
| Markdown Formatting | Validate output against tools like markdownlint or custom Laravel validation rules. |
| CI/CD Complexity | Use Laravel’s Artisan::command() to wrap the package and expose a simple CLI. |
.md files) or supplement them?@route, @middleware) that need special handling?php artisan docs:generate) for seamless CLI access.DocGenerator facade to inject Markdown generation into controllers/services.@param/@return tags to OpenAPI specs using a custom parser.push to main and auto-commit to a docs/ branch.Schema::getTableColumns())..md files with dynamically generated ones (use git update-index --assume-unchanged for generated files if needed).@see for cross-references).composer require ostico/phpdoc-md:^1.0 --dev and pin versions.@param string $name vs. @param $name string).phpdoc/phpdoc CLI to lint first).phpdoc -d app --analyze).docs/generated) for output.// app/Console/Commands/GenerateDocs.php
use Ostico\PhpdocMd\Generator;
protected $signature = 'docs:generate';
public function handle() {
$generator = new Generator();
$markdown = $generator->generateFromDirectory(app_path());
file_put_contents(docs_path('api.md'), $markdown);
}
"post-autoload-dump": "php artisan docs:generate") for dev environments.- name: Generate Documentation
run: php artisan docs:generate
- name: Commit Docs
run: |
git config --global user.name "Docs Bot"
git add docs/
git commit -m "chore: update docs [skip ci]"
git push
last-generated timestamp).ostico/phpdoc-md and phpDocumentor versions to avoid breaking changes.phpDocumentor/phpDocumentor (native Markdown output).erusev/parsedown for custom Markdown processing.phpdoc -d app --analyze to validate input.storage/ or docs/ directory).How can I help you explore Laravel packages today?