+0
Daily
9,354
stars
137
forks
16
watchers
344
prs
117
issues
52
releases
README
ReflectionDocBlock ================== Introduction ------------ The ReflectionDocBlock component of phpDocumentor provides a DocBlock parser that is 100% compatible with the PHPDoc standard. With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock. Installation ------------ bash composer require phpdocumentor/reflection-docblock Usage ----- In order to parse the DocBlock one needs a DocBlockFactory that can be instantiated using its createInstance factory method like this: php $factory = \phpDocumentor\Reflection\DocBlockFactory::createInstance(); Then we can use the create method of the factory to interpret the DocBlock. Please note that it is also possible to provide a class that has the getDocComment() method, such as an object of type ReflectionClass, the create method will read that if it exists. php $docComment = create($docComment); The create method will yield an object of type \phpDocumentor\Reflection\DocBlock whose methods can be queried: php // Contains the summary for this DocBlock $summary = $docblock-getSummary(); // Contains \phpDocumentor\Reflection\DocBlock\Description object $description = $docblock-getDescription(); // You can either cast it to string $description = (string) $docblock-getDescription(); // Or use the render method to get a string representation of the Description. $description = $docblock-getDescription()-render(); For more examples it would be best to review the scripts in the /docs/examples folder.
Top issues
#372Add @template & Conditional return types10 comments · 2024-07-09#87Location information for tags7 comments · 2016-11-04#255Inline tag handling with nested braces is not working as expected5 comments · 2020-09-20#449InvalidTag name with leading @0 comments · 2026-03-15#439Add factories for `@template-extends` and `@template-implements`0 comments · 2026-01-21#412BUG: @example tag not working0 comments · 2025-07-23#346Add more information when an InvalidTag occurs and a link to the phpDocumentor documentation0 comments · 2022-12-04#335Referring a global variable with @see $varname in a docblock causes 0 comments · 2022-05-23
Latest release
6.0.3 6.0.3 2026-03-18What's Changed PHP 8.4 fix explicit nullable deprecations by @dasginganinja in https://github.com/phpDocumentor/ReflectionDocBlock/pull/446 fix: add escaped closing docblock to escaped sequences by @bshaffer in https://github.com/phpDocumentor/ReflectionDocBlock/pull/450 Fix PHP 8.4 deprecations (see phpDocumentor451) by @danherrero in https://github.com/phpDocumentor/ReflectionDocBlock/pull/452 New Contributors @dasginganinja made their first contribution in https://github.com/phpDocumentor/ReflectionDocBlock/pull/446 @bshaffer made their first contribution in https://github.com