2017 © Pedro PelĂĄez
 

library tactician-service-provider

Silex tactician service provider

image

hellofresh/tactician-service-provider

Silex tactician service provider

  • Monday, June 20, 2016
  • by italolelis
  • Repository
  • 3 Watchers
  • 0 Stars
  • 145 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 7 Forks
  • 0 Open issues
  • 13 Versions
  • 3 % Grown

The README.md

Tactician Service Provider

Scrutinizer Code Quality Build Status, (*1)

Provides Tactician as service to Pimple or Silex Container, (*2)

Requirements

  • PHP >= 5.5
  • Silex >= 2.0
  • Pimple >= 3.0

Installation

composer require jowy/tactician-service-provider, (*3)

Usage

Register tactician service provider

$app->register(
    new TacticianServiceProvider(
        [
            'tactician.inflector' => 'class_name',
            'tactician.middleware' =>
                [
                    new LockingMiddleware()
                ]
       ]
   )
);

Register command handler in DIC

Handler must registered in container and use FQCN as service id, (*4)

$app[HandlerClass::class] = function() {
    return new HandlerClass();
};

Map command and handler

after tactician commadn bus service provider registered, you can map command and handler, (*5)

$app['tactician.locator']->addHandler(CommandClass::class, HandlerClass:class);

Dispatching Command

$command = new CommandClass('param');

$container['tactician.command_bus']->handle($command)

Options

Inflector

  • class_name
  • class_name_without_suffix
  • handle
  • invoke

For more information for choosing Inflector please refer to this documentation, (*6)

Middleware

Middleware can be added while tactician service registered was registered., (*7)

$app->register(
    new TacticianServiceProvider(
        [
            'tactician.inflector' => 'class_name',
            'tactician.middleware' =>
                [
                    new LockingMiddleware(),
                    new SomeMiddleware(),
                    new OtherMiddleware()
                ]
        ]
    )
);

Optionally lazy initialization for middleware is possible by using this method, (*8)

$app[LockingMiddleware::class] = function () {
    return new LockingMiddleware();
};

$app->register(
    new TacticianServiceProvider(
        [
            'tactician.inflector' => 'class_name',
            'tactician.middleware' =>
                [
                    LockingMiddleware::class;
                ]
        ]
    )
);

License

MIT, see LICENSE, (*9)

The Versions

20/06 2016

dev-master

9999999-dev

Silex tactician service provider

  Sources   Download

MIT

The Requires

 

by Prasetyo Wicaksono

20/06 2016

v2.1.1

2.1.1.0

Silex tactician service provider

  Sources   Download

MIT

The Requires

 

by Prasetyo Wicaksono

20/06 2016

v2.1.0

2.1.0.0

Silex tactician service provider

  Sources   Download

MIT

The Requires

 

by Prasetyo Wicaksono

22/02 2016

v2.0.0

2.0.0.0

Silex tactician service provider

  Sources   Download

MIT

The Requires

 

by Prasetyo Wicaksono

22/02 2016

dev-silex-1

dev-silex-1

Silex tactician service provider

  Sources   Download

MIT

The Requires

 

by Prasetyo Wicaksono

22/02 2016

v1.1.0

1.1.0.0

Silex tactician service provider

  Sources   Download

MIT

The Requires

 

by Prasetyo Wicaksono

22/02 2016

1.1-beta1

1.1.0.0-beta1

Silex tactician service provider

  Sources   Download

MIT

The Requires

 

by Prasetyo Wicaksono

20/02 2016

v2.0.0-beta1

2.0.0.0-beta1

Silex tactician service provider

  Sources   Download

MIT

The Requires

 

by Prasetyo Wicaksono

06/04 2015

v1.0.4

1.0.4.0

Silex tactician service provider

  Sources   Download

MIT

The Requires

 

by Prasetyo Wicaksono

01/04 2015

v1.0.3

1.0.3.0

Silex tactician service provider

  Sources   Download

MIT

The Requires

 

by Prasetyo Wicaksono

31/03 2015

v1.0.2

1.0.2.0

Silex tactician service provider

  Sources   Download

MIT

The Requires

 

by Prasetyo Wicaksono

31/03 2015

v1.0.1

1.0.1.0

Silex tactician service provider

  Sources   Download

MIT

The Requires

 

by Prasetyo Wicaksono

26/03 2015

v1.0.0

1.0.0.0

Silex tactician service provider

  Sources   Download

MIT

The Requires

 

by Prasetyo Wicaksono