PHPackages                             barryvdh/reflection-docblock - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. barryvdh/reflection-docblock

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

barryvdh/reflection-docblock
============================

v2.4.1(2mo ago)1.3k118.6M—1.8%20[2 PRs](https://github.com/barryvdh/ReflectionDocBlock/pulls)20MITPHPPHP &gt;=7.1CI passing

Since Apr 6Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/barryvdh/ReflectionDocBlock)[ Packagist](https://packagist.org/packages/barryvdh/reflection-docblock)[ RSS](/packages/barryvdh-reflection-docblock/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (35)Used By (20)

The ReflectionDocBlock Component
================================

[](#the-reflectiondocblock-component)

> This is a fork of [phpDocumentor/ReflectionDocBlock 2.x](https://github.com/phpDocumentor/ReflectionDocBlock/tree/release/2.x) combined with bits of [phpDocumentor/TypeResolver](https://github.com/phpDocumentor/TypeResolver) and various tweaks. The main reason for this fork is to add functionality for Any other use of this library is discouraged. You are probably better of using  directly.

Introduction
------------

[](#introduction)

The ReflectionDocBlock component of phpDocumentor provides a DocBlock parser that is 100% compatible with the [PHPDoc standard](http://phpdoc.org/docs/latest).

With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.

> **Note**: *this is a core component of phpDocumentor and is constantly being optimized for performance.*

Installation
------------

[](#installation)

You can install the component in the following ways:

- Use the official Github repository ()
- Via Composer ()

Usage
-----

[](#usage)

The ReflectionDocBlock component is designed to work in an identical fashion to PHP's own Reflection extension ().

Parsing can be initiated by instantiating the `\phpDocumentor\Reflection\DocBlock()` class and passing it a string containing a DocBlock (including asterisks) or by passing an object supporting the `getDocComment()` method.

> *Examples of objects having the `getDocComment()` method are the `ReflectionClass` and the `ReflectionMethod` classes of the PHP Reflection extension*

Example:

```
$class = new ReflectionClass('MyClass');
$phpdoc = new \phpDocumentor\Reflection\DocBlock($class);

```

or

```
$docblock =
