2017 © Pedro Peláez
 

library default-service

ZF2 Module for creating invokables services and with factory

image

t4web/default-service

ZF2 Module for creating invokables services and with factory

  • Sunday, June 17, 2018
  • by maxgu
  • Repository
  • 3 Watchers
  • 0 Stars
  • 837 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 5 % Grown

The README.md

DefaultService

ZF2 Module for creating invokables services and with factory., (*1)

Installation

Add this project in your composer.json:, (*2)

"require": {
  "t4web/default-service": "~1.0.0"
}

Now tell composer to download T4web\DefaultService by running the command:, (*3)

$ php composer.phar update

Post installation

Enabling it in your application.config.phpfile., (*4)

<?php
return array(
  'modules' => array(
      // ...
      'T4web\DefaultService',
  ),
  // ...
);

Problem

  1. To much invokables entries:
'invokables' => [
    CreateAction\ChangesValidator::class => CreateAction\ChangesValidator::class,
    API\AddFriend\ViewModel::class => API\AddFriend\ViewModel::class,
    API\RemoveFriend\ViewModel::class => API\RemoveFriend\ViewModel::class,
    API\CreateFriendRequest\ViewModel::class => API\CreateFriendRequest\ViewModel::class,
    API\UpdateFriendRequest\ViewModel::class => API\UpdateFriendRequest\ViewModel::class,
    // ...
],

this no sense., (*5)

  1. To much factory entries:
'factories' => [
    Domain\User\MySelf::class => Domain\User\MySelfFactory::class,
    Domain\User\Service\Creator::class => Domain\User\Service\CreatorFactory::class,
    Domain\User\Service\Updater::class => Domain\User\Service\UpdaterFactory::class,
    API\AddFriend\ChangesValidator::class => API\AddFriend\ChangesValidatorFactory::class,
    API\RemoveFriend\CriteriaValidator::class => API\RemoveFriend\CriteriaValidatorFactory::class,
    API\RemoveFriend\RemoveService::class => API\RemoveFriend\RemoveServiceFactory::class,
    API\CreateFriendRequest\CriteriaValidator::class => API\CreateFriendRequest\CriteriaValidatorFactory::class,
    API\CreateFriendRequest\Service::class => API\CreateFriendRequest\ServiceFactory::class,
    API\UpdateFriendRequest\CriteriaValidator::class => API\UpdateFriendRequest\CriteriaValidatorFactory::class,
    API\UpdateFriendRequest\Service::class => API\UpdateFriendRequest\ServiceFactory::class,
    Frontend\ShowUser\ViewModel::class => Frontend\ShowUser\ViewModelFactory::class,
    Frontend\Friends\Service::class => Frontend\Friends\ServiceFactory::class,
    Frontend\Friends\ViewModel::class => Frontend\Friends\ViewModelFactory::class,
    Backend\LoginAs\Service::class => Backend\LoginAs\ServiceFactory::class,
    Friend\Listener\FriendRequestAccept::class => Friend\Listener\FriendRequestAcceptFactory::class,
],

if your Factory naming have rules (ServiceClassName + Factory word) - no sense in that config., (*6)

Solution

Add DefaultService module in your project. In box we have only one abstract factory: DefaultServiceAbstractFactory - it very simply. If Service has Factory (ServiceClassName + Factory word) - service will created by factory. If service not have factory, but class exists - service will created by constructor., (*7)

The Versions

17/06 2018

dev-master

9999999-dev https://github.com/t4web/DefaultService

ZF2 Module for creating invokables services and with factory

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar maxgu

zf2 module factory zf2 module abstract factory

17/06 2018

1.1.3

1.1.3.0 https://github.com/t4web/DefaultService

ZF2 Module for creating invokables services and with factory

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar maxgu

zf2 module factory zf2 module abstract factory

14/06 2018

1.1.2

1.1.2.0 https://github.com/t4web/DefaultService

ZF2 Module for creating invokables services and with factory

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar maxgu

zf2 module factory zf2 module abstract factory

13/06 2018

1.1.1

1.1.1.0 https://github.com/t4web/DefaultService

ZF2 Module for creating invokables services and with factory

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar maxgu

zf2 module factory zf2 module abstract factory

13/06 2018

1.1.0

1.1.0.0 https://github.com/t4web/DefaultService

ZF2 Module for creating invokables services and with factory

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar maxgu

zf2 module factory zf2 module abstract factory

02/12 2016

1.0.0

1.0.0.0 https://github.com/t4web/DefaultService

ZF2 Module for creating invokables services and with factory

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar maxgu

zf2 module factory zf2 module abstract factory

14/06 2016

0.1.0

0.1.0.0 https://github.com/t4web/DefaultService

ZF2 Module for creating invokables services and with factory

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar maxgu

zf2 module factory zf2 module abstract factory