PHP code example of vandarpay / orchestration-saga

1. Go to this page and download the library: Download vandarpay/orchestration-saga 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/ */

    

vandarpay / orchestration-saga example snippets


$publisher = resolve(Publisher::class);
$publisher->setConnectMicroservice('microservice-a',RpcCallTypeEnum::Sync)
->setConnectMicroservice('microservice-a',RpcCallTypeEnum::Async);

$this
->setServiceName('test')
->setCallBackEvent(CallbackEvent::class)
->setRollBackEvent(RollbackEvent::class)
->callSync('actionA', ['input' => $input]);

class MicroserviceAlphaRpcService extends Service
{
    protected string $microName = 'micro-a';
    protected string $serviceName = 'test';
    protected ?string $serviceVersion = 'v1';
    public function test(){
        return $this->callSync('actionA', ['input' => $input]);
    }
}

├── Services
    ├── Test 
    |   ├── v1
    |   |   ├── TestException.php
    |   |   ├── TestRepository.php
    |   |   ├── TestTransformer.php
    |   |   └── TestService.php
    |   └── v2
    |       ├── TestException.php
    |       ├── TestRepository.php
    |       ├── TestTransformer.php
    |       └── TestService.php
    └── AlphaService