PHP code example of hellofresh / tactician-service-provider

1. Go to this page and download the library: Download hellofresh/tactician-service-provider library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hellofresh / tactician-service-provider example snippets


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

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

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

$command = new CommandClass('param');

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

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

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

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