PHP code example of phpinnacle / ensign
1. Go to this page and download the library: Download phpinnacle/ensign 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/ */
phpinnacle / ensign example snippets
HPinnacle\Ensign\DispatcherBuilder;
Amp\Loop::run(function () {
$builder = new DispatcherBuilder;
$builder
->register('upper', function (string $text) {
return \strtoupper($text);
})
->register('lower', function (string $text) {
return \strtolower($text);
})
;
$dispatcher = $builder->build();
$hello = yield $dispatcher->dispatch('upper', 'hello');
$world = yield $dispatcher->dispatch('lower', 'WORLD');
echo sprintf('%s %s!', $hello, $world);
});