PHPackages                             protec/zf2-traits - 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. protec/zf2-traits

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

protec/zf2-traits
=================

Package that provides standard ZF implementations as traits

4831PHP

Since Feb 4Pushed 13y ago6 watchersCompare

[ Source](https://github.com/protecinnovations/zf2-traits)[ Packagist](https://packagist.org/packages/protec/zf2-traits)[ RSS](/packages/protec-zf2-traits/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

ZF2 Traits
==========

[](#zf2-traits)

[![Build Status](https://camo.githubusercontent.com/5b24d48cb8816ba535e9d3d03dda3586abb79ff7821a6c696b8f0b933e3c0cb7/68747470733a2f2f7472617669732d63692e6f72672f70726f746563696e6e6f766174696f6e732f7a66322d7472616974732e706e67)](https://travis-ci.org/protecinnovations/zf2-traits)

[Zend Framework 2](http://framework.zend.com) is awesome. PHP 5.4 is also awesome. Combine both, using new PHP 5.4 features to make developing with Zend Framework 2 more fun!

Installation
------------

[](#installation)

Add `"protec/zf2-traits": "dev-master"` to your `composer.json` file and run `php composer.phar update`.

Awareness Traits
----------------

[](#awareness-traits)

Zend Framework 2 has several \*AwareTraits, used to automatically inject \* into your classes when loaded via the service locator. These traits decrease code duplication by providing a standard implementation for these interfaces. Usage is pretty simple too. Just take the full name of the interface (including namespace), replace the 'Interface' part with 'Trait', and the '\\Zend' part with '\\Protec\\ZF2Trait', and use this trait within your class:

```
class MyClass implements \Zend\ServiceManager\ServiceLocatorAwareInterface
{
    use \Protec\ZF2Trait\ServiceManager\ServiceLocatorAwareTrait;
}
```

Please Note - ZF2 &gt; 2.0.7
----------------------------

[](#please-note---zf2--207)

As of ZF2 2.0.7 - these are now available as part of Zend Framework itself - you should be able to swap out "\\Protec\\ZF2Trait" for "\\Zend"

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community10

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/32d5546010acf465053389b43a30f009de4ad45bfc2cbc16fef304df292b0717?d=identicon)[ColdFFF](/maintainers/ColdFFF)

---

Top Contributors

[![alexdenvir](https://avatars.githubusercontent.com/u/1412074?v=4)](https://github.com/alexdenvir "alexdenvir (8 commits)")

### Embed Badge

![Health badge](/badges/protec-zf2-traits/health.svg)

```
[![Health](https://phpackages.com/badges/protec-zf2-traits/health.svg)](https://phpackages.com/packages/protec-zf2-traits)
```

###  Alternatives

[magenerds/baseprice

This module displays base prices

40107.4k](/packages/magenerds-baseprice)

PHPackages © 2026

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