PHP Classes

PHP Threader: MultiThreading-like Functionality in PHP[Win&*nix]

Recommend this page to a friend!
  Info   Screenshots Screenshots   View files View files (27)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 57%Total: 3,436 All time: 991 This week: 660Up
Version License PHP version Categories
phpthreader 1.6MIT/X Consortium ...5Language, AJAX


This class can be used to add MultiThreading-like Functionality to PHP.

Online Docs Here :

The Class has an OOP Dynamic structure allowing adding Thread-Calling Classes Or Communication Classes As add-ons

it Comes with 3 Default Thread Calling Methods :-

1. Sockets : in Sockets Method it uses PHPSockets to generate POST requests to server to trigger Thread Execution.

2. Ajax : in Ajax Method It generates Javascript to generate AJAX requests to trigger Thread Execution(Js must be enabled in Client side) .

3. CLI : in CLI Methods OS Specific Shell Calls are used to trigger Thread Execution [Exec() must be enabled].

Multiple scripts may be executed in parallel.

Each thread may take it's own parameters .

it Comes with 3 Default Thread Communication & Synchronization Methods :-

1. Shared Memory (Shmop Extension must be available)

1. Flat Files

2. MySql Heap Engine/Table (Offcourse MySQL must be availabe with table creating Prevaliges)

The Class has the Features of :-

1. Completely Cross Platform Threads

3. Threads can communicate directly & Share data (Communication is Fully encapsulated) .

4. Providing Tracing of each Thread State

5. Abstract Mutex Class which can be used from user defined Communication Clases .

6. Threads can interact directly with user in Ajax Method (works best with FireFox as it implements Ajax as it should) .

Innovation Award
PHP Programming Innovation award winner
September 2007

Prize: One subscription to the PDF edition of the magazine by PHP Architect
Some times applications need to execute tasks that may take a long time to finish.

Ideally the users should be able to keep track of the progress of the tasks being executed, so they know how much of the whole task has been done and what long it may take to end.

This class can help solving these problems using AJAX requests to trigger the execution of long one or more tasks on the server side, as well retrieving information about the progress of the tasks while they have not yet finished.

Manuel Lemos
Picture of Mohammed Yousef
Name: Mohammed Yousef is available for providing paid consulting. Contact Mohammed Yousef .
Classes: 2 packages by
Country: Egypt Egypt
Age: 34
All time rank: 7057 in Egypt Egypt
Week rank: 185 Up3 in Egypt Egypt Up
Innovation award
Innovation award
Nominee: 1x

Winner: 1x

  • Class_Illustration.jpg
  Files folder image Files  
File Role Description
Files folder imageCom (4 files)
Files folder imageHandlers (2 files)
Files folder imageSync (1 file)
Files folder imageThread (4 files)
Files folder imageDoc (4 files)
Files folder imageExamples (11 files)
Plain text file AjT.js Aux. Js Class

  Files folder image Files  /  Com  
File Role Description
  Plain text file Com.php Class The Abstract Thread Communication Class
  Plain text file FileCom.php Class Flat File Communication Class
  Plain text file MyCom.php Class Using MySql Heap Engine to communicate between Threads
  Plain text file ShmopCom.php Class Shared Memory Communication Class

  Files folder image Files  /  Handlers  
File Role Description
  Plain text file Loader.php Class a very Simple function to allow easy Loading / Locating of Classes
  Plain text file PlainArray.php Class A Writting Methodolgy Class Based on Array Serailization

  Files folder image Files  /  Sync  
File Role Description
  Plain text file SimpleMutex.php Class A Class Implementing a Simple Mutex For Read and Write Sync

  Files folder image Files  /  Thread  
File Role Description
  Plain text file AjThreader.php Class The Ajax Thread Calling class
  Plain text file Caller.php Class The abstract class for calling threads
  Plain text file CliThreader.php Class Cli Thread Calling (Shell Calling)
  Plain text file SocThreader.php Class Sockets Method of calling Threads

  Files folder image Files  /  Doc  
File Role Description
  Plain text file Aj_Threader.txt Doc. Ajax Method Documentation
  Plain text file Online_Docs.txt Doc. Url to Online Docs
  Plain text file Soc_Threader.txt Doc. Socket Method Doc
  Image file Threader.jpg Screen image illustrating Class Construction

  Files folder image Files  /  Examples  
File Role Description
  Plain text file Ex1_Counter.php Example First Example Counter Thread
  Plain text file Ex1_Echoer.php Example First Example File-writting Thread
  Plain text file Ex1_MainThread.php Example First Example Main Thread
  Plain text file Ex2_Counter.php Example Second Example Counter Thread
  Plain text file Ex2_Echoer.php Example Second Example File-writting Thread
  Plain text file Ex2_MainThread.php Example Second Example Main Thread
  Plain text file Ex3_MainThread.php Example Third Example Main Thread
  Plain text file Ex3_PartDownloader.php Example Third Example File Parts Downloader Script
  Plain text file Ex4_Counter.php Example Fourth Example Counter Thread
  Plain text file Ex4_Echoer.php Example Fourth Example File-writting Thread
  Plain text file Ex4_MainThread.php Example Fourth Example Main Thread

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:991
This week:660Up
User Ratings User Comments (1)
 All time