1. Go to this page and download the library: Download rodent/readline 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/ */
rodent / readline example snippets
use \Ridzhi\Readline\Info\InfoInterface as IInfo;
class TestCompleter implements \Ridzhi\Readline\CompleteInterface
{
public function complete(string $input): array
{
$info = \Ridzhi\Readline\Info\Parser::parse($input);
switch ($info->getType()) {
case IInfo::TYPE_ARG:
// arg completion
case IInfo::TYPE_OPTION_SHORT:
// option completion
case IInfo::TYPE_OPTION_LONG:
// option completion
case IInfo::TYPE_OPTION_VALUE:
// option values completion
default:
return [];
}
}
}
$readline = new \Ridzhi\Readline\Readline();
//Alt+d
$readline->bind("\033d", function (\Ridzhi\Readline\Line $line) {
$current = $line->getCurrent();
$line->clear();
$line->insert($current);
});
$readline = new \Ridzhi\Readline\Readline();
$readline->bind("(", function (\Ridzhi\Readline\Line $line) {
$line->insert("()");
$line->cursorPrev();
});
// dark theme file
class DarkTheme implements Ridzhi\Readline\Dropdown\ThemeInterface
{
}
// console app file
// ThemeInterface implements
$readline = new \Ridzhi\Readline\Readline(new DarkTheme());
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.