Join 4,000+ others and never miss out on new tips, tutorials, and more.
4.x is outdated, please check the latest version 22.x
pecl install openswoole-22.0.0
<?php Swoole\Timer::set(array $timerSettings)\:\ void
true: Enable coroutine support within a timer callable
if successful, it returns
if the operation failed, it returns
Set the runtime settings for Timer callables. The settings can be accessed by
<?php Swoole\Timer::set([ 'enable_coroutine' => true, ]); var_dump(Swoole\Timer::setting);
You can use the
set method to enable full coroutine support within a timer context, it will automatically create a coroutine context for you so you don't need to create the initial
go() context when a timer runs.