PHPackages                             markuszeller/php-annotations - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. markuszeller/php-annotations

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

markuszeller/php-annotations
============================

Simple tool for parsing annotations

v1.0.0(6y ago)0236↓100%MITPHPPHP &gt;=7.1

Since Aug 4Pushed 6y ago1 watchersCompare

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

READMEChangelog (1)DependenciesVersions (2)Used By (0)

php-annotations
===============

[](#php-annotations)

This class helps reading annotations.

[![PHP from Packagist](https://camo.githubusercontent.com/3ef5ae2224ffcfcc090ffe13af804f0eab1750c45271d294f28d61ef0e411a8f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6d61726b75737a656c6c65722f7068702d616e6e6f746174696f6e732f76312e302e302e737667)](https://camo.githubusercontent.com/3ef5ae2224ffcfcc090ffe13af804f0eab1750c45271d294f28d61ef0e411a8f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6d61726b75737a656c6c65722f7068702d616e6e6f746174696f6e732f76312e302e302e737667)[![Install with Composer)](https://camo.githubusercontent.com/5a044970d4c50acb762b9e210d17c672617babcdaca01dcdb466e64c9603fcbc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f6d706f7365722d6d61726b75737a656c6c65722532467068702d2d616e6e6f746174696f6e732d626c75652e737667)](https://camo.githubusercontent.com/5a044970d4c50acb762b9e210d17c672617babcdaca01dcdb466e64c9603fcbc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f6d706f7365722d6d61726b75737a656c6c65722532467068702d2d616e6e6f746174696f6e732d626c75652e737667)

Features
--------

[](#features)

- reads from a string
- reads from a file
- supports multiline annotation values
- auto trims values

Note
----

[](#note)

Reads only annotations from DocComments included in `/** [...] */`.

Look into that **double asterisk**.

Usage
-----

[](#usage)

Initialise an Annotation object

```
require_once '../vendor/autoload.php';
use markuszeller\Annotations\Reader;

$reader = new Reader();

```

Put some data into the annotation reader instance

- by a string

    ```
      $cssString = file_get_contents('./template.css');
      $reader->loadFromString($cssString);

    ```
- by file

    ```
      if($reader->loadFromFile("./example.css") === false) {
          exit("Error loading file");
      }

    ```

Get all the annotations as an associative array

```
$annotationArray = $reader->getAnnotations();

```

Get a single annotation by name

```
$title = $reader->getAnnotation('title');

```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

Unknown

Total

1

Last Release

2469d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0a10b7f1f02a4c79241e1624d8cb19fcc112471cd561854307bb383dd4651fd4?d=identicon)[markuszeller](/maintainers/markuszeller)

---

Top Contributors

[![markuszeller](https://avatars.githubusercontent.com/u/71471?v=4)](https://github.com/markuszeller "markuszeller (2 commits)")

---

Tags

annotationscomposerpackageparserphp

### Embed Badge

![Health badge](/badges/markuszeller-php-annotations/health.svg)

```
[![Health](https://phpackages.com/badges/markuszeller-php-annotations/health.svg)](https://phpackages.com/packages/markuszeller-php-annotations)
```

###  Alternatives

[mtdowling/jmespath.php

Declaratively specify how to extract elements from a JSON document

2.0k472.8M135](/packages/mtdowling-jmespathphp)[opis/closure

A library that can be used to serialize closures (anonymous functions) and arbitrary data.

2.6k230.0M282](/packages/opis-closure)[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M226](/packages/masterminds-html5)[sabberworm/php-css-parser

Parser for CSS Files written in PHP

1.8k191.2M63](/packages/sabberworm-php-css-parser)[michelf/php-markdown

PHP Markdown

3.5k52.4M343](/packages/michelf-php-markdown)[jms/metadata

Class/method/property metadata management in PHP

1.8k152.8M88](/packages/jms-metadata)

PHPackages © 2026

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