PHP code example of beyerz / aws-queue-bundle

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

    

beyerz / aws-queue-bundle example snippets


public function registerBundles()
{
    return array(
        new Beyerz\AWSQueueBundle\BeyerzAWSQueueBundle(),
    );
}



namespace Acme\AcmeBundle\Producers;


use Beyerz\AWSQueueBundle\Interfaces\ProducerInterface;
use Beyerz\AWSQueueBundle\Producer\ProducerTrait;

class MyAwesomeProducer implements ProducerInterface
{
    use ProducerTrait;

    public function publish($message)
    {
        $this->producer->publish($message);
    }
}



    $myAwesomeProducer = $this->container->get('acme.my_awesome_producer');
    $myMessage = "My Awesome Message";
    $myAwesomeProducer->publish($message);



namespace Acme\AcmeBundle\Consumers;


use Beyerz\AWSQueueBundle\Interfaces\ConsumerInterface;

class MyAwesomeConsumer implements ConsumerInterface
{

    public function consume($message)
    {
        //do something awesome with your message
    }
}

bash
    php app/console beyerz:consumer awesome_consumer