PHP Queue Manager and Task Executor

PHP Queue Manager and Task Executor

A simple, fast queue manager and tasks executor. Stack your tasks to queue and execute them later.

  • Language: PHP
  • Released: Aug 19, 2011
    Last Update: Sep 10, 2011

PHP Queue Manager is a PHP component for developers to optimize their site performance by moving long executing tasks to Queue.

Features

  • Multiple queues
  • Unlimited messages in queue
  • Queues can be executed by multiple instances simultaneously
  • SQL transaction is used to ensure select only new messages for execution
  • Queues and messages are saved in SQLite database
  • Perfect to control mass mail sending
  • Easily create custom tasks by extending one abstract class
  • PHPUnit tested
  • PHP 5.3 support
  • Failover mechanism with timeouts
  • Component includes simple console manager for viewing and executing messages in queue
  • Exceptions are logged to database

Queue managers are very commonly used in enterprise applications, banking systems, financial institutions, image and video processing websites such as Vimeo or YouTube and many more.

Using this simple PHP queue manager you can also make your user happy.

If your message could not be executed (throws an exception) queue manager will try to execute it after timeout.

Where it can be used

In general this component can be useful for anyone who wants to move long running tasks to background while keeping your site visitor happy.

  • Mail sending and newsletters
  • Image processing
  • Video processing
  • Instant payment notification processing
  • Logging system
  • Save data to Google spreadsheet
  • Web crawling
  • API call requests
  • A lot more ...

Requirements and installation

Queue manager can be included in any existing project simply by including class.

  • PHP 5.3 (can be ported to PHP 5.2 on request)
  • PDO Sqlite extension enabled (can be ported to use any database on request)

After downloading package extract it to your library directory.

Make sure you have class autoloader enabled. An example autoloader is available at GitHub

Ensure that apache have the permission to write the queue.sqlite file.

If your Apache or CLI runs with the users permissions it is enough to

chmod 755 queue.sqlite

Else you can do

chmod 777 queue.sqlite

If running from Apache then you need write and execute privileges for Apache on the directory that contains your sqlite database (not just the database file itself).

Hide

Example Task in Queue

An example Message is dedicated to sending emails and it looks like this

   <?php
    namespace Queue\Message;
    use Queue\Message;
    class SendMail extends Message
    {
        public function execute()
        {
            $message = wordwrap($this->message, 70);
            mail($this->to_email, $this->subject, $message);
        }
    }

In the middle of you application you would write:

    $data = array(
        'to_email' => 'andrius.putna@gmail.com',
        'subject' => 'Regarding Queue manager component',
        'message' => 'Feedback about component',
    );
    $m = new \Queue\Message\SendMail($data);
    $q = new \Queue\Queue('EmailsQueue');
    $q->send($m);

And later on the day you would send a batch of maximum 1000 emails with the following code:

    $q = new \Queue\Queue('EmailsQueue');
    $q->execute(1000);

Aint that awesome and super easy? Parallel process made very simple indeed.

By the way, you can also use Universal queue like:

    $data = array(
        'to_email' => 'andrius.putna@gmail.com',
        'subject' => 'Regarding Queue manager component',
        'message' => 'Feedback about component',
    );
    $m = new \Queue\Message\SendMail($data);
    $q = new \Queue\Queue();
    $q->send($m);
    $q->execute(1000);
Hide

Using Web Interface to manage queue

Queue manager comes with a simple (1 file) web interface to manage queues.

Login to web manager using basic auth. (Configure users within file.)

You can execute queue manually, review stuck messages. Restart queue.

See screenshots for more information.

You need to log-in or create an account
  • Create an account
  • Log-in
Please use your real name.
Activation link will be sent to this address.
Minimum 8 characters
Enter your password again

Clicking this button confirms you read and agreed to the terms of use and privacy policy.

X

Save your watchlist

Fill your details below to receive project updates from your watch list - including new versions, price changes and discounts.

I agree to the terms of use and privacy policy.

2 licenses, starting from From » $19.99 14 day money-back guarantee View Licenses
or Get a quote

for customization or integration services

Post a comment

Or enter your name and Email
  • C chris 7 months ago
    Hi, Does PHP Queue Manager and Task Executor have API documentation?
  • HC Hernan Chiapella 9 months ago
    I want to check your ONLINE DEMO, but the link is broken, do you have another url please?
  • AH Andri Herumurti 1 year ago
    it is possible to buy personal license first then upgrade to developer license later with only 99 usd - 19 usd ?