phpDocumentor

phpDocumentor/ReflectionDocBlock

PHP MIT Dev Tools
9.4k stars
136 forks
slow
GitHub

9.4k

Stars

136

Forks

18

Open issues

30

Contributors

6.0.3 18 Mar 2026

AI Analysis

ReflectionDocBlock is a PHP library that parses DocBlocks (documentation comments) according to the PHPDoc standard, enabling libraries to extract and interpret structured metadata embedded in code comments. It serves PHP developers and documentation tools who need to programmatically analyze DocBlock annotations; it is not a general-purpose parser but rather a specialized utility for the PHP ecosystem.

Dev Tools Library Discovery value: 3/10
Documentation 8/10
Activity 6/10
Community 8/10
Code quality 8/10

Inferred from signals mentioned in the README (tests, CI, type safety) — not a review of the actual code.

Overall score 8/10

AI's overall editorial judgment — not an average of the bars above, can weigh other factors too.

php docblock-parsing phpdoc-standard reflection annotations
MIT licensed Actively maintained Well documented Niche/specialized use case Production ready
Deep Analysis · Based on README and public signals
2w ago

PHP DocBlock parser powering phpDocumentor, PHPStan, and most PHP static analysis tooling

ReflectionDocBlock is a PHP library that parses PHPDoc-style DocBlock comments into structured objects, extracting summaries, descriptions, and typed tags (@param, @return, @var, etc.). It is the foundational parsing layer used by phpDocumentor, and is pulled in transitively by Symfony, PHPStan, Psalm, PHP-CS-Fixer, and dozens of other widely deployed PHP tools. Its primary audience is tool authors — static analyzers, documentation generators, annotation-driven frameworks — rather than end-user application developers. Despite modest star counts, Packagist download numbers are enormous, placing it firmly among the most-installed PHP packages globally.

Origin

Created in April 2012 as part of the phpDocumentor project to replace ad-hoc regex parsing of DocBlocks. Has matured over 13+ years through multiple major versions, closely tracking the evolving PHPDoc PSR draft standard.

Growth

Growth is not star-driven but dependency-driven. The package is a deep transitive dependency of PHPStan, Psalm, Symfony's PropertyInfo/Serializer, and Composer plugins, meaning its install count compounds with the entire PHP ecosystem's growth. New star activity is nearly flat (1/week), which is expected for infrastructure-layer libraries.

In production

Packagist shows this package has hundreds of millions of cumulative installs, making it one of the most-downloaded PHP packages in existence. It is a declared dependency of PHPStan, Psalm, Symfony (multiple components), phpdoc-parser, and many Composer plugins. Real-world production usage is extensively verified at ecosystem scale.

Code analysis
Architecture

Appears to follow a factory-based design with DocBlockFactory as the primary entry point, producing immutable DocBlock value objects. Tags appear to be individually typed (e.g., @param, @return have dedicated classes). Likely uses phpDocumentor/TypeResolver for type parsing and phpDocumentor/ReflectionCommon for shared interfaces, suggesting a modular split across companion packages.

Tests

Scrutinizer CI coverage badge is present in the README, suggesting tracked test coverage. Specific percentage not stated in README excerpt, but the presence of a CI integration workflow and Scrutinizer integration implies active test maintenance.

Maintenance

Last push was March 18, 2026 — approximately 3 months before the evaluation date. CI workflow is active. Given the library's stable, narrow scope, infrequent pushes are appropriate and do not indicate neglect. Project is actively maintained, not stagnant.

Honest verdict

ADOPT IF: you are building a PHP tool that needs to parse or reflect on PHPDoc comments in a structured, standards-compliant way — documentation generators, static analyzers, annotation processors, or serialization frameworks. AVOID IF: you need cutting-edge union/intersection type parsing beyond the PHPDoc standard as implemented here; in that case phpstan/phpdoc-parser may be a better fit. MONITOR IF: PHP 8+ attribute adoption in your target codebase is accelerating and your use case could migrate away from DocBlock-based metadata entirely.

Independent dimensions

Mainstream potential

3/10

Technical importance

7/10

Adoption evidence

9/10

Risks
  • PHP 8 native attributes may progressively reduce the need for DocBlock-based metadata parsing in frameworks and DI containers, shrinking one segment of its use cases over time.
  • phpstan/phpdoc-parser is gaining traction as an alternative for advanced type-system use cases and could fragment the ecosystem if static analysis tools consolidate around it.
  • The library's value is tightly coupled to the PHPDoc standard, which remains a draft PSR. Any significant community divergence from that standard could require substantial rework.
  • Dependency on companion packages (TypeResolver, ReflectionCommon) means coordinated versioning is required; major version bumps across the suite can create upgrade friction for downstream consumers.
  • Very low fork count (136) relative to star count suggests limited external contribution surface, meaning the project is largely dependent on the phpDocumentor team's continued engagement.
Prediction

Likely to remain a stable, high-install infrastructure package for the PHP ecosystem for many years, with slow organic growth tied to PHP tooling adoption rather than any surge in direct usage. Gradual relevance shift as PHP attributes mature is possible but not imminent.

0 found this helpful

Newsletter

Get analyses like this every Monday

Free weekly digest of the most interesting open-source discoveries.

Languages

PHP
99.5%
Makefile
0.5%

Information

Language
PHP
License
MIT
Last updated
4mo ago
Created
174mo ago
Analyzed with
anthropic/claude-haiku-4-5

Stars over time

Loading…

Contributors over time

Top 100 contributors only — repos with more will plateau at 100.

Loading…

Similar repos

phpDocumentor

phpDocumentor/phpDocumentor

phpDocumentor is a specialized documentation generator for PHP projects that...

4.3k PHP Dev Tools
phpDocumentor

phpDocumentor/ReflectionCommon

ReflectionCommon is a PHP library providing shared reflection interfaces and...

9.1k PHP Dev Tools
phpDocumentor

phpDocumentor/TypeResolver

TypeResolver is a PHP library that implements PSR-5 specification for resolving...

9.2k PHP Dev Tools
phpstan

phpstan/phpdoc-parser

PHPDoc Parser is a specialized PHP library that parses PHPDoc comments into an...

1.5k PHP Dev Tools
Roave

Roave/BetterReflection

Better Reflection is a static analysis-focused reflection API for PHP that...

1.2k PHP Dev Tools
vs. alternatives
doctrine/annotations

Doctrine Annotations solved a similar problem (structured metadata in DocBlocks) but relied on a full annotation syntax. PHP 8 attributes have largely deprecated that approach. ReflectionDocBlock focuses on standards-compliant PHPDoc parsing and remains relevant for type analysis tooling even as attribute adoption grows.

nikic/php-parser

PHP-Parser operates at the AST level and can extract raw DocBlock strings, but does not parse their internal structure into typed tag objects. The two tools are complementary rather than competing; PHPStan and Psalm often use both.

phpstan/phpdoc-parser

PHPStan's own phpdoc-parser is a more recently built, performance-focused alternative that PHPStan itself uses internally. It has a stricter, richer type grammar. For tool authors prioritizing PHPStan-compatible type parsing, it is a credible alternative, though ReflectionDocBlock remains more widely integrated across the broader ecosystem.

phpDocumentor/ReflectionCommon + TypeResolver

Companion packages from the same organization. ReflectionDocBlock depends on them; they are not competitors but part of the same modular suite.

Custom regex-based parsers

Many older PHP projects parse DocBlocks with ad-hoc regular expressions. ReflectionDocBlock offers a standards-conformant, structured alternative. The cost of switching is the library dependency itself, which is negligible given it is likely already transitively present.