PHP code example of 99designs / sera

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

    

99designs / sera example snippets




// a simple task
class MyTask extends Sera_Task_Abstract
{
	public static function create($params)
	{
		return new self($params);
	}

	public function execute()
	{
    my_long_running_function($this->_data);
	}
}

// a queue that connects to beanstalkd
$queue = new Sera_Queue_BeanstalkQueue("127.0.0.1");
$queue->select('llama_tasks');

// enqueue the task
$queue->enqueue(MyTask::create('some data'));

// normally this would be in a seperate process
$worker = new Sera_Queue_QueueWorker($queue);
$worker->execute();