PHPackages                             alex-oleshkevich/zf-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. alex-oleshkevich/zf-annotations

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

alex-oleshkevich/zf-annotations
===============================

ZF2 module for annotated configuration.

3.0.0(8y ago)1735.1k5[1 issues](https://github.com/alex-oleshkevich/zf-annotations/issues)2MITPHPPHP &gt;=7.0.0

Since Dec 29Pushed 8y ago2 watchersCompare

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

READMEChangelogDependencies (9)Versions (33)Used By (2)

Annotations for Zend Framework.
-------------------------------

[](#annotations-for-zend-framework)

This module provides "configuration via annotation" support for Zend Framework. Out of the box it allows to define routes, service and all the ServiceManager-based implementations (as controllers, view helpers, etc).
The goal of this project is to get rid of large configuration arrays in application configs.

[![Build Status](https://camo.githubusercontent.com/6d382a4a18e8d383c009084acf528a3ff91fc63737a1bc1f2daeb601a704884d/68747470733a2f2f7472617669732d63692e6f72672f616c65782d6f6c6573686b65766963682f7a662d616e6e6f746174696f6e732e737667)](https://camo.githubusercontent.com/6d382a4a18e8d383c009084acf528a3ff91fc63737a1bc1f2daeb601a704884d/68747470733a2f2f7472617669732d63692e6f72672f616c65782d6f6c6573686b65766963682f7a662d616e6e6f746174696f6e732e737667)[![Latest Stable Version](https://camo.githubusercontent.com/a50d89eef27fba4dac108d3f027a217e91e6d0b1639c12bb2442a17681b48aaf/68747470733a2f2f706f7365722e707567782e6f72672f616c65782d6f6c6573686b65766963682f7a662d616e6e6f746174696f6e732f762f737461626c652e737667)](https://packagist.org/packages/alex-oleshkevich/zf-annotations)[![Monthly Downloads](https://camo.githubusercontent.com/9f090aa441834c62805bd74687040ccffc36b994f7e7229dbbf27573200cf5df/68747470733a2f2f706f7365722e707567782e6f72672f616c65782d6f6c6573686b65766963682f7a662d616e6e6f746174696f6e732f642f6d6f6e74686c79)](https://packagist.org/packages/alex-oleshkevich/zf-annotations)[![Total Downloads](https://camo.githubusercontent.com/4df425f823653adc34cf10bace6734203c7aff5c0d1fff126f5de7fa88dc3800/68747470733a2f2f706f7365722e707567782e6f72672f616c65782d6f6c6573686b65766963682f7a662d616e6e6f746174696f6e732f646f776e6c6f616473)](https://packagist.org/packages/alex-oleshkevich/zf-annotations)[![Latest Unstable Version](https://camo.githubusercontent.com/aaf567fc898990851e0dd3758d96967f597c18b6dd6d928af495a136d5ce5078/68747470733a2f2f706f7365722e707567782e6f72672f616c65782d6f6c6573686b65766963682f7a662d616e6e6f746174696f6e732f762f756e737461626c652e737667)](https://packagist.org/packages/alex-oleshkevich/zf-annotations)[![License](https://camo.githubusercontent.com/9fd3a3499d2e615b149f7954012ff367144d81e5ca989d53669a0771539bce8a/68747470733a2f2f706f7365722e707567782e6f72672f616c65782d6f6c6573686b65766963682f7a662d616e6e6f746174696f6e732f6c6963656e73652e737667)](https://packagist.org/packages/alex-oleshkevich/zf-annotations)[![Deps. Status](https://camo.githubusercontent.com/dbfba41ffa40ded603367a58cfb4197799a444c06c93c338173cc53ceaf8e3e4/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f757365722f70726f6a656374732f3534643437633133336361303834393533313030303262302f62616467652e7376673f7374796c653d666c6174)](https://camo.githubusercontent.com/dbfba41ffa40ded603367a58cfb4197799a444c06c93c338173cc53ceaf8e3e4/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f757365722f70726f6a656374732f3534643437633133336361303834393533313030303262302f62616467652e7376673f7374796c653d666c6174)

### Requirements

[](#requirements)

- PHP &gt;= 7.0.0

### Please, note

[](#please-note)

1. if you want to use Zend libraries from Zend Framework 2, use ~1.0 versions. Branch ~2.0 supports future versions of Zend Framework and may not be compatible with ZF 1.
2. Since version 2.3 the module does not use [zendframework/zend-code](https://github.com/zendframework/zend-code) as a backend and use [doctrine/annotations](https://github.com/doctrine/annotations) directly. See [doctrine documentation](http://docs.doctrine-project.org/projects/doctrine-common/en/latest/reference/annotations.html) for more details and options.

### Deprecations

[](#deprecations)

1. Config option "annotations" deprecated in favor of "namespaces".

### Installation

[](#installation)

##### Require via composer

[](#require-via-composer)

```
composer require alex-oleshkevich/zf-annotations
```

##### Enable it in application.config.php

[](#enable-it-in-applicationconfigphp)

```
return array(
    'modules' => array(
        // other modules
        'ZfAnnotation'
    ),
    // other content
);
```

#### Configuration:

[](#configuration)

```
array(
    'zf_annotation' => array(
        // in which modules to search annotated classes
        'scan_modules' => array(),

        // DEPRECATED AND REMOVED IN 2.3
        // here listed all annotations supported by the module
        // add your own here
        'annotations' => array(
            'ZfAnnotation\Annotation\Route',
            // ...
        ),

        /*
         * IMPORTANT NOTE:
         * The given directories should NOT be the directory where classes of the namespace are in,
         * but the base directory of the root namespace. The AnnotationRegistry uses a namespace to directory separator
         * approach to resolve the correct path.
         */
        'namespaces' => array(
            'My\Annotation' => '/path/to/annotations'
        ),

        // listeners to events emitted by parser.
        // they process class annotations and transforms them into config values
        // add your own here.
        'event_listeners' => array(
            'ZfAnnotation\EventListener\RouteListener',
            // ...
        ),
        // if not null, supplied directory would used for cache to speed up parsing
        'cache' => '/path/to/cache/dir',
        // if true, will ignore cached data and always return a fresh one.
        'cache_debug' => false
    )
)
```

### Components

[](#components)

- [Router](docs/router.md)
- [Services](docs/services.md)

### Read how to add own annotations

[](#read-how-to-add-own-annotations)

- [Custom annotations](docs/custom-annotations.md)

### Performance

[](#performance)

This module is pretty fast, but anyway, parsing of lots of files on each request takes time.
The module subscribes to `ModuleEvent::EVENT_MERGE_CONFIG` and scans every time its is triggered. If you have option `module_listener_options.config_cache_enabled` enabled, annotation parser will not do parsing unless you set `config_cache_enabled` to false or remove a cache file. [More info about caching here](https://akrabat.com/caching-your-zf2-merged-configuration/).

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity69

Established project with proven stability

 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 ~36 days

Recently: every ~113 days

Total

31

Last Release

3067d ago

Major Versions

0.1.7 → 1.02015-12-08

1.2.2 → 2.02016-03-25

2.3.3 → 3.0.02017-12-19

PHP version history (4 changes)0.1.1PHP &gt;=5.3.0

0.1.5PHP &gt;=5.4.0

1.0PHP &gt;=5.5

3.0.0PHP &gt;=7.0.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/cc63879c46ac0cb6aa7a73481f7e651d327e17f1ecf4c12435c4a5eb67608297?d=identicon)[alex.oleshkevich](/maintainers/alex.oleshkevich)

---

Top Contributors

[![alex-oleshkevich](https://avatars.githubusercontent.com/u/635848?v=4)](https://github.com/alex-oleshkevich "alex-oleshkevich (42 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/alex-oleshkevich-zf-annotations/health.svg)

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

###  Alternatives

[zf-commons/zfc-base

A set of genetic (abstract) classes which are commonly used across multiple modules.

1441.1M25](/packages/zf-commons-zfc-base)[hostnet/entity-tracker-component

Provides an event when a Tracked entity changes

16158.1k4](/packages/hostnet-entity-tracker-component)[snapshotpl/zf-snap-geoip

MaxMind GeoIP Module for Zend Framework 2

1512.9k](/packages/snapshotpl-zf-snap-geoip)[bitweb/zf2-cron-module

BitWeb ZF2 module for cron.

1341.6k](/packages/bitweb-zf2-cron-module)

PHPackages © 2026

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