PHP code example of psamatt / service-bus-lite-bundle

1. Go to this page and download the library: Download psamatt/service-bus-lite-bundle 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/ */

    

psamatt / service-bus-lite-bundle example snippets




// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Psamatt\ServiceBusLiteBundle\PsamattServiceBusLiteBundle(),
    );
}


use \ServiceBus\ICommand;

class FooCommandHandler implements \ServiceBus\ICommandHandler
{
    function handle(ICommand $command)
    {
        
    }
}


class FooController extends Controller
{
    
    public function indexAction()
    {
        // we send Commands
        $this->get('ServiceBus.Mediator')->send(new FooCommand('myEventName'));
        
        // we request Queries
        $response = $this->get('ServiceBus.Mediator')->request(new FooQuery('myEventName'));
    }