composer require appventus/php-doc-fill-bundle:dev-master
app/AppKernel.php:
public function registerBundles() {
return [
// ...
new AppVentus\PhpDocFillBundle\AvPhpDocFillBundle(),
];
}
config.yml:
framework:
templating:
engines: ['twig', 'php']
app/config/routing.yml:
av_php_doc_fill_bundle_routes:
resource: "@AvPhpDocFillBundle/Resources/config/routing.yml"
prefix: /
Onboarding New Developers:
@param and @return tags for a service method:
/**
* @param User $user The authenticated user
* @return Response JSON response
*/
public function getUserData(User $user) { ... }
CI/CD Pipeline:
.phpstan.neon rule:
parameters:
level: 5
checkMissingIterableValueType: true
Template-Based Generation:
@throws for exceptions).AvPhpDocFillBundle/Resources/views/ templates in your project.Controller Documentation: Generate PHPDoc for route handlers to auto-document API endpoints.
/**
* @Route("/api/users", name="get_users", methods={"GET"})
* @param Request $request
* @return JsonResponse List of users
*/
public function index(Request $request) { ... }
Service Layer: Use the bundle to document dependencies and return types for better IDE support (e.g., PhpStorm autocompletion).
Legacy Code Refactoring: Run the bundle’s CLI tool (if available) to batch-generate PHPDoc for large codebases:
php bin/console av:phpdoc:generate src/Entity
Debug Toolbar Dependency:
APP_DEBUG=false).phpdocfill/phpdocfill library directly for CLI generation.Template Engine Requirement:
'php' in framework.templating.engines). Missing this breaks the UI.No CLI Tool:
phpdocfill library). Use:
vendor/bin/phpdocfill generate src/ --format=php
Symfony 2.x Only:
phpdocfill/phpdocfill for newer versions.Blank Debug Toolbar Tab:
Check app/logs/dev.log for errors. Common causes:
php engine in templating.engines.AppKernel.php).Generated PHPDoc Issues:
Manually edit templates in app/Resources/AvPhpDocFillBundle/views/ to customize output (e.g., add @author tags).
Custom Docblock Templates:
Override the default template at app/Resources/AvPhpDocFillBundle/views/default/docblock.php.twig.
Exclude Directories:
Configure excluded paths in config.yml (if supported):
av_php_doc_fill:
exclude_dirs: ["src/Tests", "vendor"]
Integration with IDEs: Use generated PHPDoc to enable:
Pair with PHPStan: Enforce PHPDoc accuracy by adding rules like:
# phpstan.neon
parameters:
checkReturnTypeAgainstReturnTag: true
Git Hooks:
Add a pre-commit hook to validate PHPDoc blocks using phpdocfill validate.
Legacy Code: Use the bundle to incrementally document classes, then refine manually:
# Generate docs for a single class
vendor/bin/phpdocfill generate src/Entity/User.php --format=php
How can I help you explore Laravel packages today?