PHP code example of ibrahimgunduz34 / maria-bundle

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

    

ibrahimgunduz34 / maria-bundle example snippets



///...
public function registerBundles()
{
    $bundles = array(
        //...
        new SweetCode\MariaBundle\MariaBundle(),
        //...
    );
}
//...


return [
  //...
   SweetCode\MariaBundle\MariaBundle::class => ['all' => true],
  //...  
];


namespace App\Handler;

use SweetCode\MariaBundle\MariaEventArg;

class FreeShipmentHandler
{
    public function onAction(MariaEventArg $eventArg){
        //TODO: Write your magic code to give free shipment.
        // You can reach your original input data by:
        // $eventArg->getData();
    }
}


//...
/** @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface $eventDispatcher */
$eventDispatcher = $container->get('event_dispatcher');
// You can simply send an object or associative array to Maria through event context.
$context = [
    'amount'        => $order->getAmount(),
    'category_id'   => $order->getCategoryId(),
]
$eventDispatcher->dispatch(new \SweetCode\MariaBundle\MariaEventArg($context), 'cart.updated');
//...


///...
public function registerBundles()
{
    $bundles = array(
        //...
        new OldSound\RabbitMqBundle\OldSoundRabbitMqBundle(),
        //...
    );
}
//...


return [
  //...
   OldSound\RabbitMqBundle\OldSoundRabbitMqBundle::class => ['all' => true],
  //...  
];
bash
$ composer