PHP Classes

PHP Async Task: Execute asynchronous tasks in the background

Recommend this page to a friend!
  Info   View files View files (8)   DownloadInstall with Composer Download .zip   Reputation   Support forum (5)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 67%Total: 995 All time: 3,640 This week: 183Up
Version License PHP version Categories
slobel-async-task 1.0.6BSD License5.3.3PHP 5, Unix, Language
Description Author

This class can Execute asynchronous tasks in the background.

It can fork a parallel process and call a function of the class that will execute the task code.

Applications should create sub-classes to override the function that will execute the parallel task code.

The parallel task can take given parameters from the originating process. Property values may also be shared with the parallel task using shared memory.

The class can also kill the parallel task, check if it is killed or still running.


Console app to call mvc controller action to real time process
Console app to call mvc controller action to real time process

Picture of Dmitry Mamontov
  Performance   Level  
Name: Dmitry Mamontov <contact>
Classes: 16 packages by
Country: Russian Federation Russian Federation
Age: 31
All time rank: 81430 in Russian Federation Russian Federation
Week rank: 43 Up6 in Russian Federation Russian Federation Up
Innovation award
Innovation award
Nominee: 6x


Build Status Latest Stable Version License Total Downloads PHP Classes

OBSOLETE. The current class is available at the following link.


AsyncTask enables proper and easy use of the thread. This class allows to perform background operations and publish results on the thread without having to manipulate threads and/or handlers. More information.


  • PHP version ~5.3.3
  • Module installed pcntl and posix
  • All functions pcntl, posix and shm removed from the directive disable_functions


1) Install composer

2) Follow in the project folder:

composer require dmamontov/asynctask ~1.0.5

In config composer.json your project will be added to the library dmamontov/asynctask, who settled in the folder vendor/. In the absence of a config file or folder with vendors they will be created.

If before your project is not used composer, connect the startup file vendors. To do this, enter the code in the project:

require 'path/to/vendor/autoload.php';

Example of work

class TestTask extends AsyncTask
    protected function onPreExecute()

    protected function doInBackground($parameters)
        return $parameters;

    protected function onPostExecute($result)
        echo $result;

$task = new TestTask();
  Files folder image Files  
File Role Description
Files folder imagesrc (1 file)
Files folder imagetests (3 files)
Accessible without login Plain text file example.php Example Example script
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file phpunit.xml.dist Data Auxiliary data
Accessible without login Plain text file Doc. Auxiliary data

  Files folder image Files  /  src  
File Role Description
  Plain text file AsyncTask.php Class Class source

  Files folder image Files  /  tests  
File Role Description
  Accessible without login Plain text file AsyncTaskInstance.php Test Unit test script
  Accessible without login Plain text file AsyncTaskTest.php Test Unit test script
  Accessible without login Plain text file bootstrap.php Test Unit test script

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:3,640
This week:183Up
User Ratings User Comments (2)
 All time
The easiest class on this subject.
7 years ago (Vasiliy Trutov)
Work is Awesome
7 years ago (Chintan Patel)
For more information send a message to info at phpclasses dot org.