Need help with ReflectionDocBlock?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

8.8K Stars 89 Forks MIT License 631 Commits 17 Opened issues

Services available


Need anything else?

Contributors list

License: MIT Qa workflow Coveralls Coverage Scrutinizer Code Coverage Scrutinizer Code Quality Stable Version Unstable Version



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.


composer require phpdocumentor/reflection-docblock


In order to parse the DocBlock one needs a DocBlockFactory that can be instantiated using its

factory method like this:
$factory  = \phpDocumentor\Reflection\DocBlockFactory::createInstance();

Then we can use the

method of the factory to interpret the DocBlock. Please note that it is also possible to provide a class that has the
method, such as an object of type
, the create method will read that if it exists.
$docComment = <<create($docComment);


method will yield an object of type
whose methods can be queried:
// 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


We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.