phpdocumentor/shim
Composer shim to install phpDocumentor as a PHAR. Downloads the official release PHAR from the main phpDocumentor repo and places it in vendor/bin for easy use in your project. Use main repo for bleeding-edge versions and issue tracking.
phpdocumentor/shim package provides a Composer-friendly wrapper for phpDocumentor, enabling seamless integration into Laravel projects for automated API/library documentation. Its alignment with Laravel’s dependency management (Composer) and CLI tooling (vendor/bin) makes it a natural fit for developer tooling and CI/CD pipelines.phpDocumentor v3.x’s changes.ruudk/laravel-docgen exist, this package offers broader PHPDoc/OpenAPI support and performance improvements (e.g., parallel processing in v3.10.0).phpdocumentor/phpdocumentor is installed separately. The shim ensures a single source of truth for the PHAR.vendor/bin, making it globally accessible in Laravel projects without manual PATH configuration.phpDocumentor v3.x introduced PSR-12-compliant template paths (e.g., vendor/phpdocumentor/templates-twbsbootstrap), requiring updates to phpdocumentor.dist.php.phpDocumentor v3.10.0 drops PHP 7.4/8.0 support, requiring Laravel projects to upgrade to PHP 8.1+. This may block adoption for legacy Laravel apps.| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| PHP Version Incompatibility | Critical | Upgrade Laravel to PHP 8.1+ (LTS). Test thoroughly in staging. |
| Deprecated APIs | High | Audit custom commands/templates for Transformer or Event usage. Replace with Processor-based workflows. |
| Template Path Changes | Medium | Update phpdocumentor.dist.php to use PSR-12 paths (e.g., vendor/phpdocumentor/templates-*). |
| Parallel Processing | Low | Leverage --processes flag in CI/CD for performance gains. |
| PHAR Stability | Medium | Monitor for future PHAR deprecation in phpDocumentor. Consider fallback to phpdocumentor/phpdocumentor if needed. |
phpdocumentor/shim@^3.9 (last PHP 8.0-compatible version).templates/twbsbootstrap)? If yes, update to vendor/phpdocumentor/templates-twbsbootstrap.phpDocumentor classes (e.g., Transformer)? If so, refactor to use the new Processor API.--processes) reduce documentation generation time? Benchmark in staging.phpDocumentor v3.10.0 introduce new annotation syntax (e.g., @deprecated handling)? Review release notes for compatibility.phpdocumentor/phpdocumentor already installed? If yes, remove it to avoid conflicts with the shim.symfony/process).phpDocumentor APIs. Use the new Processor class for workflows.--processes=4).ruudk/laravel-docgen: Better for Laravel-specific docs (e.g., Blade templates), but lacks phpDocumentor’s flexibility.darkaonline/l5-swagger: Ideal for APIs, but not a drop-in replacement for general PHPDoc.php -v (must be 8.1+).composer.json for phpdocumentor/phpdocumentor conflicts. Remove if present.composer require phpdocumentor/shim:^3.10.0 --dev
composer update
phpdocumentor.dist.php:
return [
'templates' => ['vendor/phpdocumentor/templates-twbsbootstrap'],
'source' => ['src', 'app/Http/Controllers'],
'target' => 'docs/api',
'parallel' => ['processes' => 4], // Enable parallel processing
];
Transformer usage with Processor:
// OLD (deprecated)
$transformer = new \phpDocumentor\Transformer\DefaultTransformer();
// NEW
$processor = new \phpDocumentor\Processor();
$processor->process($sourceFiles);
- name: Generate Documentation
run: vendor/bin/phpdocumentor run --processes=4 --directory=docs/api
@deprecated, @method).| Component | Compatibility Notes |
|---|---|
| PHP Version | PHP 8.1+ required. Laravel 8.33+ or 9.x recommended. |
| Composer | Works natively, but may require composer update to resolve new dependencies. |
| Templates | PSR-12 paths required (e.g., vendor/phpdocumentor/templates-*). |
| Artisan Commands | Must use Processor instead of deprecated Transformer or Event APIs. |
| CI/CD | Parallel processing (--processes) improves performance but may require cache invalidation. |
| Annotations | New syntax (e.g., @deprecated) may require updates to PHPDoc blocks. |
phpDocumentor versions are managed via Composer, reducing manual PHAR updates.phpDocumentor.phpDocumentor changes directory structure.phpDocumentor has an active community (7K stars) and MIT license.How can I help you explore Laravel packages today?