PHPackages                             kamermans/docblock-reflection - 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. kamermans/docblock-reflection

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

kamermans/docblock-reflection
=============================

Simple, Fast PHP DocBlock Parser / Reflector

v1.0.1(10y ago)9277.5k↓21.2%23MPLPHPPHP &gt;=5.3

Since Oct 23Pushed 6y ago2 watchersCompare

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

READMEChangelog (2)Dependencies (2)Versions (3)Used By (3)

docblock-reflection
===================

[](#docblock-reflection)

[![Build Status](https://camo.githubusercontent.com/19024fe7d7533c7cbd0eaf097a4b7e2bea29dd6fb9a32beb00a72c27ba79cfa1/68747470733a2f2f7472617669732d63692e6f72672f6b616d65726d616e732f646f63626c6f636b2d7265666c656374696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/kamermans/docblock-reflection)

Simple, Fast PHP DocBlock Parser / Reflector

This is a dead-simple DocBlock / doc comment / PHPDoc parser. It separates a block into tags and a comment and that's it. Nothing fancy here. If you want fancy, use the Doctrine Annotation bundle.

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

[](#installation)

Use Composer to install by adding this to your `composer.json`:

```
	"require": {
		"kamermans/docblock-reflection": "~1.0"
	}

```

Usage
-----

[](#usage)

This library is basically used for grabbing comments and tags, so here are some examples:

Consider this class

```
/**
 * A Foo class
 *
 * @deprecated
 * @version      v1.1
 * @see          Foo::bar()
 * @see          google.com
 */
class Foo {
	/**
	 * Does something that is really
	 * cool and makes your life easy
	 *
	 * @param string $name Your name
	 * @return string
	 */
	public function bar($name) {
		return "FooBar $name";
	}
}
```

We can explore it using the stock Reflection API, but it doesn't parse the DocBlocks

```
$reflect = new RelflectionClass("Foo");
echo $reflect->getDocComment(); // spits out the raw block
```

To dig into the comment, use `kamermans\Reflection\DocBlock`. You can pass anything that implements the `Reflector` interface and has a `getDocComment()` method. That means `ReflectionObject`, `ReflectionClass`, `ReflectionMethod`, `ReflectionFunction`, etc.

```
use kamermans\Reflection\DocBlock;

$reflect = new ReflectionClass("Foo");
$doc = new DocBlock($reflect);

// Check if the @deprecated tag exists
$doc->tagExists("deprecated");

// Get the comment "A Foo class"
$doc->getComment();

echo $doc->version; // v1.1

// The same tag can be set multiple times
echo implode("|", $doc->see); // Foo::bar()|google.com

// It works on methods too
$doc = new DocBlock($reflect->getMethod("bar"));
echo "Foo returns a $doc->return\n"; // Foo returns a string

// Multiline comments work too
$doc->getComment();
```

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity41

Moderate usage in the ecosystem

Community17

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~515 days

Total

2

Last Release

3710d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/266265?v=4)[Steve Kamerman](/maintainers/kamermans)[@kamermans](https://github.com/kamermans)

---

Top Contributors

[![kamermans](https://avatars.githubusercontent.com/u/266265?v=4)](https://github.com/kamermans "kamermans (6 commits)")[![drowe-wayfair](https://avatars.githubusercontent.com/u/126295987?v=4)](https://github.com/drowe-wayfair "drowe-wayfair (2 commits)")[![uuf6429](https://avatars.githubusercontent.com/u/230049?v=4)](https://github.com/uuf6429 "uuf6429 (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kamermans-docblock-reflection/health.svg)

```
[![Health](https://phpackages.com/badges/kamermans-docblock-reflection/health.svg)](https://phpackages.com/packages/kamermans-docblock-reflection)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
