PHPackages                             zf-hipsters/zfh-abstract-factory - 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. zf-hipsters/zfh-abstract-factory

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

zf-hipsters/zfh-abstract-factory
================================

A simple module that removes the requirement to setup invokables and factories for services and controllers..

0.92(12y ago)9181PHPPHP &gt;=5.3.3

Since Oct 22Pushed 12y ago3 watchersCompare

[ Source](https://github.com/zf-hipsters/abstract-factory)[ Packagist](https://packagist.org/packages/zf-hipsters/zfh-abstract-factory)[ Docs](https://github.com/zf-hipsters/abstract-factory)[ RSS](/packages/zf-hipsters-zfh-abstract-factory/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)Dependencies (1)Versions (4)Used By (0)

Abstract Factory
================

[](#abstract-factory)

A simple module that removes the requirement to setup invokables and factories for services and controllers.

There is no requirement to use aliases that make your code inconsistant, just use the full namespace and the abstract will find it and instantiate it when required.

This module is aimed at saving time which would otherwise be spent on configuration.

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

[](#installation)

1. Add the following requirement to your projects composer.json file.

Within the "require" section:

```
"zf-hipsters/abstract-factory": ">=0.9"
```

2. Open up your command line and run

```
php ./composer.phar update

```

2. Add 'ZfhAbstractFactory' to your /config/application.config.php modules

Route Example
-------------

[](#route-example)

Without ZfhAbstractFactory being enabled, you need to register your controllers within configuration such as:

```
'controllers' => array(
    'invokables' => array(
        'Album\Controller\Album' => 'Album\Controller\AlbumController',
    ),
),

```

When ZfhAbstractFactory is enabled, you can avoid registering controllers in this way if you use the FQN of the controller in your route.

Note: the FQN of the controller has been used.

```
'router' => array(
        'routes' => array(
            'home' => array(
                'type' => 'Zend\Mvc\Router\Http\Literal',
                'options' => array(
                    'route'    => '/',
                    'defaults' => array(
                        'controller'    => 'Application\Controller\IndexController',
                        'action'     => 'index',
                    ),
                ),
            ),�
        )
);

```

Another example with dynamic with fixed controller and a dynamic action.

```
'smurf' => array(
    'type' => 'Zend\Mvc\Router\Http\Segment',
    'options' => array(
        'route'    => '/smurf[/:action]',
        'controller' => 'Application\Controller\SmurfController',
        'defaults' => array(
            'action' => 'index',
        ),
    ),
),

```

ServiceManager Example
----------------------

[](#servicemanager-example)

In your controller file

```
$this->getServiceLocator()->get('Application\Service\MyService');

```

Calling a factory

```
$this->getServiceLocator()->get('Application\Service\MyServiceFactory');

```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 77.8% 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 ~0 days

Total

3

Last Release

4585d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/335268e9ef408185a955d86c198669761984e623d7b72c37b757b4ed5a9cd526?d=identicon)[aaron4m](/maintainers/aaron4m)

---

Top Contributors

[![dkcwd](https://avatars.githubusercontent.com/u/2194542?v=4)](https://github.com/dkcwd "dkcwd (7 commits)")[![olliebrennan](https://avatars.githubusercontent.com/u/669978?v=4)](https://github.com/olliebrennan "olliebrennan (2 commits)")

---

Tags

zf2 abstract factory service

### Embed Badge

![Health badge](/badges/zf-hipsters-zfh-abstract-factory/health.svg)

```
[![Health](https://phpackages.com/badges/zf-hipsters-zfh-abstract-factory/health.svg)](https://phpackages.com/packages/zf-hipsters-zfh-abstract-factory)
```

###  Alternatives

[dudapiotr/zftable

Flexible tool to generate table

7530.9k](/packages/dudapiotr-zftable)[slm/google-analytics

Google Analytics tracking integration for Zend Framework 2

4180.3k](/packages/slm-google-analytics)[blanchonvincent/zf2-lazy-loading-module

ZF2 Lazy Loading Module 1.5.2 - Provide a library to implements lazy loading module in ZF2

353.7k](/packages/blanchonvincent-zf2-lazy-loading-module)[zf-hipsters/bootstrap-flash-messenger

Simple implementation of ZF2 flash messengers using bootstrap. Contains easy helpers that will save you a LOT of time.

159.3k](/packages/zf-hipsters-bootstrap-flash-messenger)[blanchonvincent/cdn-light

ZF2 module v1.1.0 - Manage your own CDN with ZF2 application

103.6k](/packages/blanchonvincent-cdn-light)

PHPackages © 2026

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