Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Phpdoc Parser Laravel Package

phpstan/phpdoc-parser

PHPDoc Parser for PHPStan that parses, represents, and modifies PHPDoc blocks as an AST. Supports rich type syntax (unions, generics, shapes, callables, conditional types), constant expressions, and Doctrine annotations, with full API reference for nodes.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Enables building static analysis tools (like PHPStan) that require accurate parsing of modern PHPDoc features (generics, intersection types, Doctrine annotations) for code quality checks.
  • Supports documentation generators that need to parse, modify, and re-render PHPDoc comments while preserving original formatting and structure.
  • Reduces build-vs-buy tradeoffs by providing a battle-tested parser (used by PHPStan) instead of reinventing a custom solution for complex PHPDoc processing.
  • Facilitates IDE integrations and code refactoring tools that need to interpret and manipulate type annotations in real-time.
  • Accelerates roadmap execution for features requiring deep PHPDoc understanding (e.g., automated type inference, docstring-driven code generation).

When to Consider This Package

  • Adopt when your project requires precise parsing/modification of PHPDoc comments with support for advanced PHP features (e.g., generics, union/intersection types, Doctrine annotations) and format-preserving output.
  • Consider when integrating with PHP ecosystems (e.g., PHPStan, Doctrine ORM) or building tools that process PHPDoc-heavy codebases where accuracy and compatibility are critical.
  • Look elsewhere if your use case is limited to simple tag parsing (e.g., basic @param extraction) without AST manipulation needs, or if you require non-PHPDoc annotation systems (e.g., JSDoc for JavaScript projects).
  • Avoid if your team lacks PHP expertise or if the project has no PHPDoc processing requirements, as this package adds unnecessary complexity.

How to Pitch It (Stakeholders)

Executives: "This is the industry-standard PHPDoc parser used by PHPStan—the most widely adopted static analysis tool in PHP. It eliminates months of engineering effort to build a custom parser from scratch, while ensuring compatibility with modern PHP features like generics and Doctrine annotations. By leveraging this proven solution, we can rapidly deliver high-value code quality and documentation features that improve developer productivity and reduce technical debt, all with minimal maintenance overhead."

Engineering: "It provides a robust AST-based parser with format-preserving printing, handling complex PHPDoc scenarios (e.g., generics, intersection types, Doctrine annotations) out of the box. The API is well-documented, actively maintained, and battle-tested in production by PHPStan. Integrating it gives us a reliable foundation for building code analysis tools without reinventing low-level parsing logic—freeing

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport