Initial commit

This commit is contained in:
2024-02-27 02:08:29 +01:00
commit c92c40b45a
7 changed files with 889 additions and 0 deletions

21
examples/timers.php Normal file
View File

@ -0,0 +1,21 @@
<?php
use React\EventLoop\Loop;
require_once __DIR__."/vendor/autoload.php";
$shell = new NoccyLabs\React\Shell\Shell();
$shell->on('prompt', function () use ($shell) {
$shell->setPrompt(date("H:i:s> "));
});
$shell->on('input', function (array $input) use ($shell) {
$shell->write("You entered: ".join(" ", $input)."\n");
});
// The shell is an OutputStream
$shell->write("Hello World!\n\n");
Loop::addPeriodicTimer(5, function () use ($shell) {
$shell->write(date(DATE_ATOM)."\n");
});