PHPDoc Generator is a powerful Visual Studio Code extension that intelligently generates and updates PHPDoc blocks for your PHP code. It supports advanced features such as PHP parsing, docblock preservation, custom @settings integration, MySQL/cached settings, and robust error handling. The extension is designed for real-world PHP projects and is available on the VS Code Marketplace.
Improved PHP 8 Union Return Type Support: Extension now correctly handles functions with union return types (int|string, array|bool, etc.), generating accurate docblocks and properly updating existing ones.
Automatic synchronization of @throws tags in the docblock—new exception types are added when detected in the function, and obsolete tags are removed if the corresponding throw statement is commented out or deleted.
The default docblock structure is now:
@param
@throws
@return
Parameter and return types are always provided in the docblock, even when not explicitly mentioned in the code (defaults to mixed or void).
Exclude patterns: Provided setting to specify folders and files to skip during project-wide docblock generation. The default exclude list is:
**/node_modules/**
**/vendor/**
**/.git/**
New setting: showStatusBarToggle (default: true). Controls whether the status bar toggle for Generate/Update on Save is visible. If set to false, the status bar toggle will be hidden.
All improvements apply to both single-block, file, and entire-project docblock generation.
Features
Intelligent PHPDoc Generation
Parses PHP code for accurate block detection.
Generates and updates PHPDoc blocks for functions, methods, and classes.
Preserves user-written docblock content, including multi-line summaries and descriptions.
Robust handling of edge cases and formatting.
Full support for PHP 8 union return types and parameter types.
Open a PHP file and use the command palette or keyboard shortcuts to generate or update PHPDoc blocks.
(Optional, for Accrete Globus Technology only) Configure your MySQL credentials and settings cache as described in the extension settings for advanced features.