This package is abandoned and no longer maintained. The author suggests using the phpowermove/docblock package instead.

PHP Docblock parser and generator. An API to read and write Docblocks.

v4.0 2021-09-22 16:57 UTC

This package is auto-updated.

Last update: 2021-09-22 17:03:29 UTC


License Latest Stable Version Total Downloads Tests Coverage report Scrutinizer Code Quality Code Coverage

PHP Docblock parser and generator. An API to read and write Docblocks.

WARNING: starting from version 4.0 the library has moved to phpowermove organization and the namespace is phpowermove\docblock.


Install via Composer:

composer require phpowermove/docblock


1. Generate a Docblock instance

a) Simple:

use phpowermove\docblock\Docblock;

$docblock = new Docblock();

b) Create from string:

use phpowermove\docblock\Docblock;

$docblock = new Docblock('/**
 * Short Description.
 * Long Description.
 * @author gossi

c) Create from reflection:

use phpowermove\docblock\Docblock;

$docblock = new Docblock(new \ReflectionClass('MyClass'));

2. Manipulate tags

Get the tags:

$tags = $docblock->getTags();

Get tags by name:

$tags = $docblock->getTags('author');

Append a tag:

use phpowermove\docblock\tags\AuthorTag;

$author = new AuthorTag();

or with fluent API:

use phpowermove\docblock\tags\AuthorTag;


Check tag existence:


3. Get back the string

Call toString():


or if you are in a write-context, the magical __toString() will take care of it:

echo $docblock;

Documentation Api

See https://phpowermove.github.io/docblock


Feel free to fork and submit a pull request (don't forget the tests) and I am happy to merge.



Refer to Releases