PHP code example of envoylope / event-loop

1. Go to this page and download the library: Download envoylope/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/ */

    

envoylope / event-loop example snippets




declare(strict_types=1);

use Asmblah\PhpAmqpCompat\AmqpCompatPackage;
use Asmblah\PhpCodeShift\Cache\Layer\FilesystemCacheLayerFactory;
use Asmblah\PhpCodeShift\ShiftPackage;
use Envoylope\EventLoop\EventLoopSchedulerFactory;
use Nytris\Boot\BootConfig;
use Nytris\Boot\PlatformConfig;
use Tasque\Core\Scheduler\ContextSwitch\TimeSliceStrategy;
use Tasque\EventLoop\TasqueEventLoopPackage;
use Tasque\TasquePackage;

$bootConfig = new BootConfig(new PlatformConfig(__DIR__ . '/var/cache/nytris'));

$bootConfig->installPackage(new AmqpCompatPackage(
    // Install the scheduler.
    schedulerFactory: new EventLoopSchedulerFactory()
));
$bootConfig->installPackage(new ShiftPackage(
    cacheLayerFactory: new FilesystemCacheLayerFactory(),
    relativeSourcePaths: ['src', 'vendor']
));
$bootConfig->installPackage(new TasquePackage(
    new TimeSliceStrategy(timeSliceCheckIntervalTocks: 100)
));
$bootConfig->installPackage(new TasqueEventLoopPackage());

return $bootConfig;