Weave 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

Reflection Docblock Laravel Package

phpdocumentor/reflection-docblock

A DocBlock parser fully compatible with the PHPDoc standard. Use its DocBlockFactory to read summaries, descriptions, tags, and annotations from doc comments or reflection classes, so your library can extract embedded documentation and metadata.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Build vs. buy for PHPDoc parsing: Adopt this package instead of building an in-house DocBlock parser. It is standards-compliant, MIT-licensed, and maintained by the phpDocumentor project, which lowers engineering cost and long-term maintenance risk.
  • Feature decisions for developer-facing tooling: Enables features that need structured metadata from code comments—IDE helper generation, API/documentation generation, custom lint rules, code generators, and migration tooling from legacy docblock annotations to PHP 8 attributes.
  • Roadmap for annotation-based configuration: If the product supports annotations in docblocks (routing, validation, ORM-like metadata, custom tags), this package is the parsing layer. For greenfield features, weigh docblock annotations against native PHP 8 attributes.
  • Use cases to prioritize:
    • Extracting @param, @return, @var, @method, @property, @mixin, @deprecated, and custom tags for tooling.
    • Runtime annotation reading for libraries/frameworks that still rely on docblocks.
    • Documentation generation and code intelligence (phpDocumentor itself uses this component).
    • Migration assistance: parse legacy docblock annotations and auto-generate attribute equivalents.
    • Caching parsed metadata at scale—parsed DocBlock objects are serializable.
  • Prioritization signal: Integration effort is low (Composer + a factory call), but this is infrastructure, not a user-facing differentiator. The value comes from the developer features it unlocks.

When to Consider This Package

  • Consider adoption when:
    • You need to parse PHPDoc-compliant docblocks into structured objects: summary, description, tags, and resolved types.
    • You are building or extending developer tools: doc generators, IDE helpers, static analyzers, code generators, or migration utilities.
    • You need to support legacy docblock annotations while planning a transition to PHP 8 attributes.
    • You need graceful handling of malformed tags (InvalidTag) and serialization for caching parsed results.
    • You need type resolution for @param, @return, and @var via phpdocumentor/type-resolver.
  • Look elsewhere when:
    • You only need to extract one or two tags; a lightweight regex may be cheaper and simpler.
    • You need to parse PHP 8 attributes; use native ReflectionAttribute instead.
    • You need full static analysis or generics-aware type parsing. This library explicitly does not support generics notation such as array<string, string>; PHPStan/Psalm have richer parsers.
    • You need Doctrine-style annotation objects with complex instantiation semantics; that is a different tool (and Doctrine annotations are deprecated in favor of attributes).
    • You need to parse non-PHPDoc comment formats or custom DSLs.
    • You require vendor SLAs or guaranteed long-term commercial support; this is community OSS, albeit actively maintained.

How to Pitch It (Stakeholders)

  • Executives: This is a small, MIT-licensed, standards-compliant parser that lets us add metadata-driven developer features without building and maintaining a parser ourselves. It reduces time-to-market for tooling such as documentation generation, IDE helpers, and code generation, and carries low adoption risk because it is the canonical parser from the phpDocumentor project and is actively maintained for current PHP versions, including PHP 8.4 fixes. It is a building block, not a product differentiator by itself—the business value is in the developer features it unlocks.
  • Engineering: Use DocBlockFactory::createInstance()->create($docComment) to obtain summary, description, and tags; type resolution is handled through phpdocumentor/type-resolver. Malformed tags degrade into InvalidTag objects rather than breaking parsing, and parsed results are serializable for caching. Caveats: no generics notation support, and it parses PHPDoc metadata rather than runtime annotation objects—for new code, prefer PHP 8 attributes where possible. Integrate behind an internal interface so the parser can be swapped if requirements change.
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.
rlacerda83/query-parser
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings
coleus/apps
seampact/laravel
emmyconceptng/laravel-ng-postcode