PHP code example of symfony-bundles / queue-bundle
1. Go to this page and download the library: Download symfony-bundles/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/ */
symfony-bundles / queue-bundle example snippets
php
public function registerBundles()
{
$bundles = [
// ...
new SymfonyBundles\QueueBundle\SymfonyBundlesQueueBundle(),
// ...
];
...
}
php
$queue = $this->get('sb_queue'); // get the service
// or use: $this->get('queue'); the `queue` service use as alias,
// which setting in config.yml in parameter `sb_queue.service.alias`
// adding some data to queue
$queue->push('User "demo" registered');
$queue->push(1234567890);
$queue->push(new \stdClass);
// get count of items from queue
$queue->count(); // returns integer: 3