PHP code example of wowo / wowo-queue-bundle

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

    

wowo / wowo-queue-bundle example snippets

 bash
$ php bin/vendors install
 bash
$ php composer.phar install
 php

// app/autoload.php

$loader->registerNamespaces(array(
    // ...
        'Wowo' => __DIR__.'/../vendor/bundles',
        ));
 php
// ...
 php

// app/AppKernel.php

public function registerBundles()
{
        $bundles = array(
            // ...
            new Wowo\QueueBundle\WowoQueueBundle(),
        );
}
 php
$manager = $this->get('wowo_queue.manager');
 php
$manager->put(json_encode(array('payload' => 'Hello world', 'date' => new \DateTime())));
 php
while ($job = $manager->get()) {
    $data = json_decode($job->getData(), true);
    printf("Job date: %s, payload: %s\n", $data['date']['date'], $data['payload']);
}
 php
$job = $manager->get();
$manager->delete($job);
 php
$implementation = new Wowo\QueueBundle\Implementation\BeanstalkdQueueImplementation();
$implementation->configure(array(
    'address' => 'localhost',
    'tube' => 'foo-tube',
));
$manager = new Wowo\QueueBundle\QueueManager($implementation);
 php
eanstalk_classloader::register('pheanstalk/classes/');