PHP Classes
elePHPant
Icontem

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    
Last Updated Ratings Unique User Downloads Download Rankings
2019-02-04 (5 months ago) RSS 2.0 feedStarStarStarStar 67%Total: 914 This week: 3All time: 3,819 This week: 101Up
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.

Recommendations

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

  Performance   Level  
Name: Dmitry Mamontov <contact>
Classes: 15 packages by
Country: Russian Federation Russian Federation
Age: 28
All time rank: 92633 in Russian Federation Russian Federation
Week rank: 38 Up4 in Russian Federation Russian Federation Up
Innovation award
Innovation award
Nominee: 6x

 

Details

Build Status Latest Stable Version License Total Downloads PHP Classes

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

AsyncTask

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.

Requirements

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

Installation

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();
$task->execute('test');
  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 README.md 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  
 100%
Total:914
This week:3
All time:3,819
This week:101Up
User Ratings User Comments (2)
 All time
Utility:83%StarStarStarStarStar
Consistency:87%StarStarStarStarStar
Documentation:83%StarStarStarStarStar
Examples:87%StarStarStarStarStar
Tests:-
Videos:-
Overall:67%StarStarStarStar
Rank:619
 
The easiest class on this subject.
4 years ago (Vasiliy Trutov)
77%StarStarStarStar
Work is Awesome
4 years ago (Chintan Patel)
60%StarStarStarStar