PHPackages                             webiny/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. webiny/annotations

ActiveLibrary

webiny/annotations
==================

Webiny Annotations Component

v1.6.1(8y ago)21001MITPHPPHP ^7

Since Sep 20Pushed 8y ago8 watchersCompare

[ Source](https://github.com/Webiny/Annotations)[ Packagist](https://packagist.org/packages/webiny/annotations)[ Docs](http://www.webiny.com/)[ RSS](/packages/webiny-annotations/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)Dependencies (5)Versions (23)Used By (1)

Annotations Component
=====================

[](#annotations-component)

This simple component lets you read annotations assigned to a `class`, `method` or a `property`.

Install the component
---------------------

[](#install-the-component)

The best way to install the component is using Composer.

```
composer require webiny/annotations
```

For additional versions of the package, visit the [Packagist page](https://packagist.org/packages/webiny/annotations).

Configuration and setup
-----------------------

[](#configuration-and-setup)

The component configuration is minimal, you just need to define the bridge dependency. The built-in bridge uses [Minime\\Annotations](https://github.com/marcioAlmada/annotations) library.

```
Annotations:
    Bridge: \Webiny\Component\Annotations\Bridge\Minime\Annotations
    # You don't need this part if you are using Composer autoload.
    ClassLoader:
        Minime\Annotations: /var/www/Vendors/Minime/Annotations/src
```

Once defined, you can start parsing the annotations. The best approach is to use the `AnnotationsTrait`. Let's say that this is the class that you wish to parse the annotations from.

```
/**
 * This is a class description with some annotations.
 *
 * @prop SomeProperty that has a string value.
 * @author.name AuthorName
 * @author.email author@name.com
 * @author.website.url http://www.webiny.com
 * @author.website.desc My website
 *
 */
class TestClass
{
    /**
     * @var SomeVarAnnotation
     * @public
     */
    var $someVar;

    /**
     * @access.role ADMIN
     * @access.level 3
     * @name SomeName
     */
    private $_anotherVar;

    /**
     * @post @get
     * @cache.ttl 10
     * @cache.store true @cache.key cacheKey
     * @accept ["json", "xml"]
     */
    function someMethod()
    {

    }
}
```

In your class, where you wish to do the actually parsing, just use the `AnnotationsTrait`. Trait methods return an instance of `ConfigObject` giving you the option to use the `get` method and to chain the namespaces. Annotation namespaces are fully supported, giving you the possibility to organize the annotations in much cleaner way.

```
class MyClass
{
    use AnnotationsTrait;

    function getClassAnnotations()
    {
        $classAnnotations = $this->annotationsFromClass('TestClass');
        $classAnnotations->prop; // SomeProperty that has a string value.
        $classAnnotations->author->website->url; // http://www.webiny.com
    }

    function getPropertyAnnotations()
    {
        $someVarPropertyAnnotations = $this->annotationsFromProperty('TestClass', 'someVar');
        $someVarPropertyAnnotations->public; // returns "true"
    }

    function getMethodAnnotations()
    {
        $methodAnnotations = $this->annotationsFromMethod('TestClass', 'someMethod');
        $methodAnnotations->cache->key; // cacheKey
        $methodAnnotations->accept; // [0 => "json", 1 => "xml"]
    }
}
```

Resources
---------

[](#resources)

To run unit tests, you need to use the following command:

```
$ cd path/to/Webiny/Component/Annotations/
$ composer.phar install
$ phpunit

```

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 96.4% 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 ~52 days

Recently: every ~5 days

Total

22

Last Release

3153d ago

PHP version history (3 changes)v1.0.0PHP &gt;=5.4.0

v1.2.1PHP &gt;=5.5.9

1.5.x-devPHP ^7

### Community

Maintainers

![](https://www.gravatar.com/avatar/4440afa738ed146b05c06073a90345e0464c4f4d042b039532d881ca24859d77?d=identicon)[SvenAlHamad](/maintainers/SvenAlHamad)

---

Top Contributors

[![SvenAlHamad](https://avatars.githubusercontent.com/u/3808420?v=4)](https://github.com/SvenAlHamad "SvenAlHamad (27 commits)")[![marcioAlmada](https://avatars.githubusercontent.com/u/227395?v=4)](https://github.com/marcioAlmada "marcioAlmada (1 commits)")

---

Tags

phpdocannotations

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[doctrine/lexer

PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.

11.2k910.8M118](/packages/doctrine-lexer)[phpdocumentor/reflection-common

Common reflection classes used by phpdocumentor to reflect the code structure

9.1k706.8M26](/packages/phpdocumentor-reflection-common)[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[symfony/property-info

Extracts information about PHP class' properties using metadata of popular sources

2.2k256.7M854](/packages/symfony-property-info)[jms/metadata

Class/method/property metadata management in PHP

1.8k152.8M88](/packages/jms-metadata)[dereuromark/cakephp-ide-helper

CakePHP IdeHelper Plugin to improve auto-completion

1862.1M27](/packages/dereuromark-cakephp-ide-helper)

PHPackages © 2026

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