Documentation

Libedit extends GNUReadline
in package

A Libedit-based Readline implementation.

This is largely the same as the Readline implementation, but it emulates support for readline_list_history since PHP decided it was a good idea to ship a fake Readline implementation that is missing history support.

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
Let's emulate GNU Readline by manually reading and parsing the history file!
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.
parseHistoryLine()  : string
From GNUReadline (readline/histfile.c & readline/histexpand.c): lines starting with "\0" are comments or timestamps; if "\0" is found in an entry, everything from it until the next line is a comment.

Properties

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()

Let's emulate GNU Readline by manually reading and parsing the history file!

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

parseHistoryLine()

From GNUReadline (readline/histfile.c & readline/histexpand.c): lines starting with "\0" are comments or timestamps; if "\0" is found in an entry, everything from it until the next line is a comment.

protected parseHistoryLine(string $line) : string
Parameters
$line : string

The history line to parse

Return values
string

| null

Search results