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

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

nette/reflection
================

Nette Reflection: docblock annotations parser and common reflection classes

v2.4.2(8y ago)854.8M↓10.5%2720BSD-3-ClausePHPPHP &gt;=5.6.0

Since Jun 24Pushed 7y ago31 watchersCompare

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

READMEChangelog (9)Dependencies (5)Versions (12)Used By (20)

Nette PHP Reflection
====================

[](#nette-php-reflection)

[![Downloads this Month](https://camo.githubusercontent.com/26ed7211b7c2bac074970fde5bdb4d2f2bd52a0bcf2919d9697913791615087b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6e657474652f7265666c656374696f6e2e737667)](https://packagist.org/packages/nette/reflection)[![Build Status](https://camo.githubusercontent.com/391c855af508d5220978d39070649e08c1976cd2b143e625ee26f1ea8d6f99f5/68747470733a2f2f7472617669732d63692e6f72672f6e657474652f7265666c656374696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/nette/reflection)[![Coverage Status](https://camo.githubusercontent.com/5a05d0487399d77e0fed7b754396256ec04e413f3abde91faa633d779132b652/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6e657474652f7265666c656374696f6e2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/nette/reflection?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/0ac26bc99895c54d73111af4c28f971f9214b4e9e9bdb50b73e114b7ee8dd39d/68747470733a2f2f706f7365722e707567782e6f72672f6e657474652f7265666c656374696f6e2f762f737461626c65)](https://github.com/nette/reflection/releases)[![License](https://camo.githubusercontent.com/fa7d5fcf2c84b580327af52da95dd751703af65f079dc3c5a0081beac0789718/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4e65772532304253442d626c75652e737667)](https://github.com/nette/reflection/blob/master/license.md)

Install it using Composer:

```
composer require nette/reflection

```

The last stable release requires PHP version 5.6 or newer (is compatible with PHP 7.0 and 7.1).

If you like Nette, **[please make a donation now](https://nette.org/donate)**. Thank you!

If you need to find every information about any class, reflection is the right tool to do it. You can easily find out which methods does any class have, what parameters do those methods accept, etc.

```
// getting PDO class reflection
$classReflection = new Nette\Reflection\ClassType('PDO');

// getting PDO::query method reflection
$methodReflection = new Nette\Reflection\Method('PDO', 'query');
```

Annotations
-----------

[](#annotations)

Reflection has really a lot to do with annotations. The annotations are written into phpDoc comments (two opening asterisks are mandatory!) and start with `@`. You can annotate classes, variables and methods:

```
/**
 * @author John Doe
 * @author Tomas Marny
 * @secured
 */
class FooClass
{
	/** @Persistent */
	public $foo;

	/** @User(loggedIn, role=Admin) */
	public function bar() {}
}
```

In the code there are these annotations:

- `@author John Doe` - string, contains text value `'John Doe'`
- `@Persistent` - boolean, its presence means `true`
- `@User(loggedIn, role=Admin)` - contains associative `array('loggedIn', 'role' => 'Admin')`

The existence of a class annotation can be checked via `hasAnnotation()` method:

```
$fooReflection = new Nette\Reflection\ClassType('FooClass');
$fooReflection->hasAnnotation('author'); // returns true
$fooReflection->hasAnnotation('copyright'); // returns false
```

Values can be acquired with `getAnnotation()`:

```
$fooReflection->getAnnotation('author'); // returns string 'Tomas Marny'

$fooReflection->getMethod('bar')->getAnnotation('User');
// returns array('loggedIn', 'role' => 'Admin')
```

.\[caution\] Previous definitions are overwritten with the latter ones, sou you will always get the last one.

All annotations can be obtained with `getAnnotations()`:

```
array(3) {
	"author" => array(2) {
		0 => string(8) "John Doe"
		1 => string(11) "Tomas Marny"
	}
	"secured" => array(1) {
		0 => bool(true)
	}
}

```

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity58

Moderate usage in the ecosystem

Community44

Growing community involvement

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 88% 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 ~112 days

Recently: every ~123 days

Total

11

Last Release

3228d ago

PHP version history (2 changes)v2.2.0PHP &gt;=5.3.1

v2.4.0PHP &gt;=5.6.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/17f266513a3ca97500ec3d85d562b9279c7a6346358fe2b8d90390ece717a027?d=identicon)[david@grudl.com](/maintainers/david@grudl.com)

---

Top Contributors

[![dg](https://avatars.githubusercontent.com/u/194960?v=4)](https://github.com/dg "dg (161 commits)")[![milo](https://avatars.githubusercontent.com/u/439140?v=4)](https://github.com/milo "milo (3 commits)")[![JanTvrdik](https://avatars.githubusercontent.com/u/175109?v=4)](https://github.com/JanTvrdik "JanTvrdik (3 commits)")[![Majkl578](https://avatars.githubusercontent.com/u/144181?v=4)](https://github.com/Majkl578 "Majkl578 (2 commits)")[![enumag](https://avatars.githubusercontent.com/u/539462?v=4)](https://github.com/enumag "enumag (2 commits)")[![fprochazka](https://avatars.githubusercontent.com/u/158625?v=4)](https://github.com/fprochazka "fprochazka (2 commits)")[![vrana](https://avatars.githubusercontent.com/u/117453?v=4)](https://github.com/vrana "vrana (2 commits)")[![VasekPurchart](https://avatars.githubusercontent.com/u/406821?v=4)](https://github.com/VasekPurchart "VasekPurchart (1 commits)")[![kravco](https://avatars.githubusercontent.com/u/115938?v=4)](https://github.com/kravco "kravco (1 commits)")[![greeny](https://avatars.githubusercontent.com/u/3734204?v=4)](https://github.com/greeny "greeny (1 commits)")[![juzna](https://avatars.githubusercontent.com/u/227416?v=4)](https://github.com/juzna "juzna (1 commits)")[![achtan](https://avatars.githubusercontent.com/u/1048212?v=4)](https://github.com/achtan "achtan (1 commits)")[![michalhlavka](https://avatars.githubusercontent.com/u/15013378?v=4)](https://github.com/michalhlavka "michalhlavka (1 commits)")[![OndraM](https://avatars.githubusercontent.com/u/793041?v=4)](https://github.com/OndraM "OndraM (1 commits)")[![tacoberu](https://avatars.githubusercontent.com/u/1828339?v=4)](https://github.com/tacoberu "tacoberu (1 commits)")

---

Tags

annotationsdoc-commentsnettenette-frameworkphpphpdocreflectionnettereflectionannotation

### Embed Badge

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

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

###  Alternatives

[nette/php-generator

🐘 Nette PHP Generator: generates neat PHP code for you. Supports new PHP 8.5 features.

2.3k64.2M576](/packages/nette-php-generator)[nette/robot-loader

🍀 Nette RobotLoader: high performance and comfortable autoloader that will search and autoload classes within your application.

89352.7M321](/packages/nette-robot-loader)[nette/component-model

⚛ Nette Component Model

28516.5M92](/packages/nette-component-model)[nette/code-checker

✅ Nette CodeChecker: A simple tool to check source code against a set of Nette coding standards.

881.7M6](/packages/nette-code-checker)[contributte/di

Extra contrib to nette/di

465.8M18](/packages/contributte-di)[kdyby/forms-replicator

Nette forms container replicator aka addDynamic

32997.7k6](/packages/kdyby-forms-replicator)

PHPackages © 2026

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