PHPackages                             reliv/zf-config-factories - 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. [Framework](/categories/framework)
4. /
5. reliv/zf-config-factories

ActiveLibrary[Framework](/categories/framework)

reliv/zf-config-factories
=========================

Configurable DI for the ZF service manager. Modeled after Symfony 2's DI config files.

4.3.2(7y ago)55.4k320BSD-3-ClausePHPPHP &gt;=5.6

Since Mar 27Pushed 7y ago10 watchersCompare

[ Source](https://github.com/reliv/zf-config-factories)[ Packagist](https://packagist.org/packages/reliv/zf-config-factories)[ Docs](https://github.com/rodmcnew)[ RSS](/packages/reliv-zf-config-factories/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (30)Used By (20)

[![Build Status](https://camo.githubusercontent.com/e85b4977fb5016c216a6c4dc3771ef14aea7e3d3a32b8503b289fc526534609e/68747470733a2f2f7472617669732d63692e6f72672f72656c69762f7a662d636f6e6669672d666163746f726965732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/reliv/zf-config-factories)

Zend Framework Config Factories
===============================

[](#zend-framework-config-factories)

Factory classes are tedious. Factory closures have performance issues. Try this module to use factory config arrays instead. The config structure was modeled after Symfony 2 services.yml files. This package is a module for ZF2, ZF3, and Zend-Expressive.

```
// Example of constructor injection with the service name being the same as its class name:
'service_manager' => [
    'config_factories' => [
        'App\Email\EmailService' => [
            'arguments' => [
                'Name\Of\A\Service\I\Want\To\Inject',
                'Name\Of\A\AnotherService\I\Want\To\Inject'
            ],
        ]
    ]
]
```

Example usage with all options:

```
// Use 'dependencies' instead of 'service_manager' here if using Zend Expressive
'service_manager' => [

    // This is a special config key that zf-config-factories reads.
    'config_factories' => [

        // This is the name of the service that we are defining.
        'EmailTemplateApi' => [

            /**
             * This is the service's class name.
             * Not required if the service's name is the same as its class name.
             */
            'class' => 'App\Controller\EmailTemplateApiController',

            /**
             * This is an array of service names that the class's constructor takes.
             * Not required if the service's constructor takes no arguments.
             * Not compatible with the 'factory' option (see below)
             */
            'arguments' => [
                'Name\Of\A\Service\I\Want\To\Inject',
                'Name\Of\A\Service\I\Want\To\Inject2',
                'Name\Of\A\Service\I\Want\To\Inject3',
                'Name\Of\A\Service\I\Want\To\Inject4',
                ['literal' => 'aLiteralValueNotAService'],
                ['from_config' => 'keyOfValueFromZfConfigIWantToReadAndInjectHere'],
                ['from_config' => ['path','to','a','deep','nested','zf','config','key']],
                'Name\Of\A\Service\I\Want\To\Inject5',
            ],

            /**
             * This is an array of setters to call mapped to service names to inject into each setter.
             * Not required if your service has no setters.
             */
            'calls' => [
                ['setFunService', ['Name\Of\Another\Service\I\Want\To\Inject']],
                ['setAnotherFunService', ['Name\Of\Another\Service\I\Want\To\Inject']]
            ],

             /**
             * Zend-Expressive style factory which is an invokable class
             *
             * Not required if your service has no factory.
             * Not compatible with the 'arguments' option (see above)
             */
            'factory' => 'FunModule\FactoryClassName',

            /**
             * Symfony style factory that is a service itself.
             *
             * Not required if your service has no factory.
             * Not compatible with the 'arguments' option (see above)
             */
            'factory' => [
                ['FunModule\FactoryServiceName', 'createEmailTemplateApi']
            ]
        ]
    ],
]
```

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community27

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 96.1% 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 ~42 days

Recently: every ~84 days

Total

29

Last Release

2889d ago

Major Versions

1.0.7 → 2.0.02015-10-17

2.3.0 → 3.0.02016-01-12

3.0.0 → 4.0.02016-09-26

PHP version history (4 changes)1.0.1PHP &gt;=5.3.3

1.0.4PHP &gt;=5.4

2.1.0PHP &gt;=5.5

4.3.1PHP &gt;=5.6

### Community

Maintainers

![](https://www.gravatar.com/avatar/3d89ed9b1fb36217e63fbabed855b75ccbca9a740b8662ed44aa982d5d7c98f7?d=identicon)[reliv](/maintainers/reliv)

---

Top Contributors

[![rodmcnew](https://avatars.githubusercontent.com/u/1828506?v=4)](https://github.com/rodmcnew "rodmcnew (199 commits)")[![innaDavis](https://avatars.githubusercontent.com/u/6775475?v=4)](https://github.com/innaDavis "innaDavis (3 commits)")[![jerv13](https://avatars.githubusercontent.com/u/853222?v=4)](https://github.com/jerv13 "jerv13 (3 commits)")[![bradharms](https://avatars.githubusercontent.com/u/1239044?v=4)](https://github.com/bradharms "bradharms (2 commits)")

---

Tags

containerframeworkconfigurationconfiginjectionzenddiservicemanagerzf2factoriesclosuresdependancy

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/reliv-zf-config-factories/health.svg)

```
[![Health](https://phpackages.com/badges/reliv-zf-config-factories/health.svg)](https://phpackages.com/packages/reliv-zf-config-factories)
```

###  Alternatives

[webino/webino-image-thumb

Image Thumbnailer for Zend Framework 2

4079.0k](/packages/webino-webino-image-thumb)

PHPackages © 2026

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