| Recommend this page to a friend! |
| Info | Documentation | Reputation | Support forum | Blog | Links |
| Ratings | Unique User Downloads | Download Rankings | ||||
| Total: 409 | All time: 6,500 This week: 43 | |||||
| Version | License | PHP version | Categories | |||
| axync 1.0 | MIT/X Consortium ... | 7.0 | Language, PHP 7 |
a smart cooperative multitasking kernel for php7 (only) .
require "axync.php"; // our workers builder $build = function($seq){ // this will be the generated coroutine // yes, it MUST yield ! return (function() use($seq) { for ( $i = 0; $i < 10; $i ++ ) { printf("Worker (%d): i'm in the step no. %d \n", $seq, $i); yield; } }); }; // create new manager (new Axync( $build(1), $build(2), $build(3) ))->exec(); // save your file as ~/tst1.php // open your terminal and `php ~/tst1.php` and see the result . require "axync.php"; // our workers builder $build = function($seq){ // this will be the generated coroutine // yes, it MUST yield ! return (function() use($seq) { for ( $i = 0; $i < 10; $i ++ ) { printf("Worker (%d): i'm in the step no. %d \n", $seq, $i); yield; } }); }; // create new manager // and convert to to a new Generator !! $manager1 = (new Axync( $build(1), $build(2), $build(3) ))->toGenerator(); // create a new manager that handles new generators (new Axync( $build(10), $build(20), $build(30), $manager1 // yes, axync support nested axync of axync too ;) ))->exec(); // save your file as ~/tst2.php // open your terminal and `php ~/tst2.php` and see the result . | The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
| Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
| 100% |
|
|
| User Ratings | ||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||
| Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.