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

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

miny/annotation
===============

A small annotation library written in PHP.

02.1kPHP

Since May 5Pushed 10y ago1 watchersCompare

[ Source](https://github.com/MinyFramework/Miny-Annotation)[ Packagist](https://packagist.org/packages/miny/annotation)[ RSS](/packages/miny-annotation/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![Build Status](https://camo.githubusercontent.com/d117d970fa6f2e47a9fd547ea6c7c202741d2bf17b830cd6be508d34455e3001/68747470733a2f2f7472617669732d63692e6f72672f6275676164616e692f416e6e6f74696e792e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/bugadani/Annotiny)

Annotiny
========

[](#annotiny)

Annotiny is a small library designed to read and parse documentation comments.

Usage
-----

[](#usage)

To create the AnnotationReader object a suitable parser must be supplied.

```
$parser = new \Annotiny\AnnotationParser(new \Annotiny\AnnotationContainer);
$annotationReader = new \Annotiny\AnnotationReader($parser, $factory);

```

Annotation has four public methods: `readClass($class)`, `readFunction($function)`, `readMethod($class, $method)` and `readProperty($class, $property)`. These functions work as one would expect, e.g. `readMethod` reads and parses the documentation comment of a class or object method.

### The Comment object

[](#the-comment-object)

The resulting data structure of a `read*` method is a Comment instance. Comments hold the description and the parsed tags of the documentation comment.

Comment provides several useful methods to work with the annotation tags.

- `has($tag)` checks if a tag is present
- `get($tag)` retrieves the tag value
- `equals($tag, $value)` checks if the value of `$tag` equals to `$value`
- `contains($tag, $value)` checks if `$value` is present in the argument list of the annotation
- `containsAll($tag, $value_array)` checks if each member of `$value_array` is present
- `getDescription()` returns the description part of the comment

If a tag is not found, an `OutOfBoundsException` is thrown.

Comment syntax
--------------

[](#comment-syntax)

A documentation comment is directly (e.g. no blank lines between them) above the documented class, function, method or property. The comment begins with `/**` and end with `*/`. Every line should optionally begin with an asterisk (\*).

The comment begins with the description part that is terminated by a `@tag`.

### Examples:

[](#examples)

```
/** This is a one-liner */

/**
 * Multiple lines
 *
 * @annotation
 */

```

Annotation syntax
-----------------

[](#annotation-syntax)

Annotation tags are preceded with an at-sign (@) and they start on a new line. The tag name can consist of letters, numbers, dash (-) and underscode (\_) signs but must begin with at least one letter. The following are examples of invalid tag names: `@1tag`, `@-tag`.

There are three types of annotations:

- Simple annotations that do not have values (`@tag`)
- Annotations that are followed by their values (`@tag that has a value`).
- Annotations that are followed by parameter list (`@tag(value, 'other value')`.

The values are strings delimited by commas. In the secound case only one value is allowed, commas and the following text are discarded. The third case allowes multiple values that are separated by commas. To allow commas and newlines in the value, simply enclose it in ' or ".

If multiple annotations are present with the same name, their values will be aggregated in an array. In this case, annotations without values will be ignored.

Note: named parameters are supported in the parameter list syntax. In this case an `=` sign separates the name and the value.

### Examples:

[](#examples-1)

- `@tag`
- `@tag value`
- `@tag "some value"`
- `@tag()`
- `@tag(simple value)`
- `@tag(multiple, values)`
- `@tag(name='value')`

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/2ba12833634c15d1916a7f3f29be4d1a89d40c36e7ebab46a576ff9b6e75caa6?d=identicon)[bugadani](/maintainers/bugadani)

---

Top Contributors

[![bugadani](https://avatars.githubusercontent.com/u/977627?v=4)](https://github.com/bugadani "bugadani (61 commits)")

### Embed Badge

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

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

PHPackages © 2026

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