2017 © Pedro Peláez
 

library zfh-abstract-factory

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

image

zf-hipsters/zfh-abstract-factory

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

  • Monday, October 28, 2013
  • by aaron4m
  • Repository
  • 3 Watchers
  • 9 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Abstract Factory

A simple module that removes the requirement to setup invokables and factories for services and controllers., (*1)

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., (*2)

This module is aimed at saving time which would otherwise be spent on configuration., (*3)

Installation

1) Add the following requirement to your projects composer.json file., (*4)

Within the "require" section:, (*5)

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

2) Open up your command line and run, (*6)

php ./composer.phar update

2) Add 'ZfhAbstractFactory' to your /config/application.config.php modules, (*7)

Route Example

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

'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., (*9)

Note: the FQN of the controller has been used., (*10)

'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., (*11)

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

ServiceManager Example

In your controller file, (*12)

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

Calling a factory, (*13)

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

The Versions

28/10 2013

dev-master

9999999-dev https://github.com/zf-hipsters/abstract-factory

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

  Sources   Download

The Requires

 

zf2 abstract factory service

22/10 2013

0.9

0.9.0.0 https://github.com/zf-hipsters/abstract-factory

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

  Sources   Download

The Requires

 

zf2 abstract factory service

22/10 2013

0.91

0.91.0.0 https://github.com/zf-hipsters/abstract-factory

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

  Sources   Download

The Requires

 

zf2 abstract factory service

22/10 2013

0.92

0.92.0.0 https://github.com/zf-hipsters/abstract-factory

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

  Sources   Download

The Requires

 

zf2 abstract factory service