1. Go to this page and download the library: Download workbunny/event-loop library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
workbunny / event-loop example snippets
use WorkBunny\EventLoop\Loop;
use WorkBunny\EventLoop\Drivers\NativeLoop;
use WorkBunny\EventLoop\Drivers\EventLoop;
use WorkBunny\EventLoop\Drivers\EvLoop;
use WorkBunny\EventLoop\Drivers\SwowLoop;
// 创建PHP原生loop
$loop = Loop::create(NativeLoop::class);
// 创建ext-event loop
$loop = Loop::create(EventLoop::class);
// 创建ext-ev loop
$loop = Loop::create(EvLoop::class);
// 创建swow loop
$loop = Loop::create(SwowLoop::class);
use WorkBunny\EventLoop\Loop;
// 注册
loop::register(YourLoopClass::class);
// 创建
$yourLoop = Loop::create(YourLoopClass::class);