Github url


by phpDocumentor

phpDocumentor /ReflectionDocBlock
8.1K Stars 86 Forks Last release: 25 days ago (5.2.0) MIT License 529 Commits 55 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

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.