|Ratings|| ||Unique User Downloads|| ||Download Rankings|
|Not enough user ratings||Total: 190 This week: 1||All time: 8,524 This week: 491|
This class can run code asynchronously using the PHP program.
It can take the code of a given closure and makes it run using the PHP program to create a separate process.
The class can take callback functions to run when the called code finishes, or in case of error.
How this work?
Well its basically "exec" with serialised closure. "Dressed" in nice libs like symfony process and console.
I serialise callable function and sent to child process by exec. To get callback I register shutdown function and wait for process to finish.
Why not pcntl ?
Pcntl extension fork, so you can forget using it in web applications like apache2/php-fpm etc its only for CLI
forks retains the parent state (for example open files) so its problematic
Calling exec is slower then fork
Some resource/function/data must be passed directly to closure
https://www.phproundtable.com/episode/asynchronous-php - good start to "know how" make php async
https://amphp.org/ - non-blocking framework for PHP
Sure take a look - https://github.com/krowinski/async/blob/master/example/example.php
Supports M$ Windows?
||Applications that use this package
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.