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"); });