thenlabs / tick-async
1.0.x-dev
2022-01-03 15:30 UTC
Requires
- thenlabs/task-loop: 2.0.x-dev
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.2
- thenlabs/pyramidal-tests: 2.0.x-dev
This package is auto-updated.
Last update: 2025-03-01 00:36:56 UTC
README
Asynchronous tasks based on ticks.
If you like this project gift us a ⭐.
Installation.
$ composer require thenlabs/task-loop 2.0.x-dev thenlabs/tick-async 1.0.x-dev
This project not contains a stable version yet.
Usage.
TODO
Example:
<?php declare(ticks=1); require __DIR__.'/vendor/autoload.php'; use function ThenLabs\TickAsync\async; async(function () { for ($i = 1; $i <= 15; $i++) { echo "async: {$i}\n"; yield; } return; }); for ($i = 1; $i <= 5; $i++) { echo "main: {$i}\n"; } echo "bye\n";
Result:
async: 1
main: 1
async: 2
main: 2
async: 3
main: 3
async: 4
main: 4
async: 5
main: 5
async: 6
async: 7
bye
async: 8
async: 9
async: 10
async: 11
async: 12
async: 13
async: 14
async: 15