PHPackages                             donquixote/annotation-parser - 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. donquixote/annotation-parser

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

donquixote/annotation-parser
============================

1.0.x-dev(8y ago)18211MITPHPPHP &gt;=5.6.0

Since Aug 24Pushed 8y ago1 watchersCompare

[ Source](https://github.com/donquixote/annotation-parser)[ Packagist](https://packagist.org/packages/donquixote/annotation-parser)[ RSS](/packages/donquixote-annotation-parser/feed)WikiDiscussions 1.0 Synced today

READMEChangelogDependenciesVersions (7)Used By (1)

[![Build Status](https://camo.githubusercontent.com/9e08f7e5d1bebac981b7fb3b2d958ccd5344134cdb5972630d0bb12457208187/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f646f6e717569786f74652f616e6e6f746174696f6e2d7061727365722e706e67)](https://travis-ci.org/donquixote/annotation-parser)

Donquixote's Annotation Parser
==============================

[](#donquixotes-annotation-parser)

Alternative to other annotation parsers. Specifically [doctrine/annotations](https://github.com/doctrine/annotations).

Usage
-----

[](#usage)

Look into [AnnotationReaderTest](tests/src/AnnotationReaderTest.php) for inspiration.

The non-trivial part is to create the [AnnotationReader](src/Reader/AnnotationReader.php), more specifically the [AnnotationResolver](src/Resolver/AnnotationResolver.php), from smaller components, depending on the desired behavior.

Difference to doctrine/annotations
----------------------------------

[](#difference-to-doctrineannotations)

The main difference is that annotation parsing in this library happens in two steps:

1. Parsing the doc comment into an abstract syntax tree (AST).
2. Resolving this AST into annotation objects or any other kind of structure.

This separations allows to remove some assumptions of how annotations work, and make them optional.

E.g. in Doctrine, the idea is that an annotation tag name refers to a class name or class alias, and parsing the annotation means instantiating this class. Here, this behavior is just one possibility among others.

In Doctrine, the way an annotation class is instantiated depends on metadata on the annotation class. Here, such behavior could be implemented as an InstantiatorFinder, but it is not baked into the main architecture.

It is interesting to know that Doctrine is currently planning a 2.x branch, see [doctrine/annotations#75](https://github.com/doctrine/annotations/pull/75). There is also an interesting issue at [doctrine/annotations#139](https://github.com/doctrine/annotations/issues/139).

Stability
---------

[](#stability)

For the 1.0 branch I might still do some renames, which are guaranteed to break user code. So treat it as preview quality!

However, any other projects that I maintain that depend on this library will be ok.

The 0.0 branch is kinda stable, as far as BC breaks are concerned.

Use case
--------

[](#use-case)

For now, I created this to use it in my own projects, such as . At the time I started this, doctrine/annotations did not feel like the right tool.

If others find it useful, let me know!

###  Health Score

25

—

LowBetter than 36% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~74 days

Recently: every ~0 days

Total

6

Last Release

3227d ago

Major Versions

v0.0.0-alpha1 → v1.0.0-alpha12017-08-28

0.0.x-dev → v1.0.0-alpha32017-08-29

PHP version history (2 changes)v0.0.0-alpha1PHP &gt;=5.5.0

v1.0.0-alpha2PHP &gt;=5.6.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/150032?v=4)[Andreas Hennings](/maintainers/donquixote)[@donquixote](https://github.com/donquixote)

---

Top Contributors

[![donquixote](https://avatars.githubusercontent.com/u/150032?v=4)](https://github.com/donquixote "donquixote (42 commits)")

### Embed Badge

![Health badge](/badges/donquixote-annotation-parser/health.svg)

```
[![Health](https://phpackages.com/badges/donquixote-annotation-parser/health.svg)](https://phpackages.com/packages/donquixote-annotation-parser)
```

PHPackages © 2026

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