GNUReadline
in package
implements
Readline
A Readline interface implementation for GNU Readline.
This is by far the coolest way to do it, but it doesn't work with new PHP.
Oh well.
Interfaces, Classes and Traits
- Readline
- An interface abstracting the various readline_* functions.
Table of Contents
- $eraseDups : bool
- $historyFile : string|false
- $historySize : int
- __construct() : mixed
- GNU Readline constructor.
- addHistory() : bool
- Add a line to the command history.
- clearHistory() : bool
- Clear the command history.
- isSupported() : bool
- GNU Readline is supported iff `readline_list_history` is defined. PHP decided it would be awesome to swap out GNU Readline for Libedit, but they ended up shipping an incomplete implementation. So we've got this.
- listHistory() : array<string|int, mixed>
- List the command history.
- readHistory() : bool
- Read the command history.
- readline() : false|string
- Read a single line of input from the user.
- redisplay() : mixed
- Redraw readline to redraw the display.
- writeHistory() : bool
- Write the command history to a file.
Properties
$eraseDups
protected
bool
$eraseDups
$historyFile
protected
string|false
$historyFile
$historySize
protected
int
$historySize
Methods
__construct()
GNU Readline constructor.
public
__construct([string|false $historyFile = null ], int $historySize[, bool $eraseDups = false ]) : mixed
Parameters
- $historyFile : string|false = null
- $historySize : int
- $eraseDups : bool = false
Return values
mixed —addHistory()
Add a line to the command history.
public
addHistory(mixed $line) : bool
Parameters
- $line : mixed
Return values
bool —Success
clearHistory()
Clear the command history.
public
clearHistory() : bool
Return values
bool —Success
isSupported()
GNU Readline is supported iff `readline_list_history` is defined. PHP decided it would be awesome to swap out GNU Readline for Libedit, but they ended up shipping an incomplete implementation. So we've got this.
public
static isSupported() : bool
Return values
bool —listHistory()
List the command history.
public
listHistory() : array<string|int, mixed>
Return values
array<string|int, mixed> —readHistory()
Read the command history.
public
readHistory() : bool
Return values
bool —Success
readline()
Read a single line of input from the user.
public
readline([mixed $prompt = null ]) : false|string
Parameters
- $prompt : mixed = null
Return values
false|string —redisplay()
Redraw readline to redraw the display.
public
redisplay() : mixed
Return values
mixed —writeHistory()
Write the command history to a file.
public
writeHistory() : bool
Return values
bool —Success