PHP code example of equip / beanstalkd-consumer

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

    

equip / beanstalkd-consumer example snippets


namespace Acme;

use Equip\BeanstalkConsumer\ConsumerInterface;
use Equip\BeanstalkConsumer\Job;

class FooConsumer implements ConsumerInterface
{
    public function consume(Job $job)
    {
        $id = $job->getId();
        $data = $job->getData();

        // unserialize and process $data here
    }
}

namespace Acme;

use Equip\BeanstalkdConsumer\Configuration\DefaultConfigurationSet;
use Equip\Configuration\ConfigurationSet;

class Configuration extends ConfigurationSet
{
    public function __construct()
    {
        parent::__construct([
            DefaultConfigurationSet::class,
            FooConfiguration::class,
            BarConfiguration::class,
            // etc.
        ]);
    }
}