# GNU Readline

# Introduction

The readline functions implement an interface to the GNU Readline library. These are functions that provide editable command lines. An example being the way Bash allows you to use the arrow keys to insert characters or scroll through command history. Because of the interactive nature of this library, it will be of little use for writing Web applications, but may be useful when writing scripts used from a command line.

As of PHP 7.1.0 this extension is supported on Windows.

Caution

The readline extension is not thread-safe! Thus, the usage of it with any true thread safe SAPI (like Apache mod_winnt) is strongly discouraged.

- Installing/Configuring
  - Requirements
  - Installation
  - Runtime Configuration
- Predefined Constants
- Readline Functions
  - readline — Reads a line
  - readline_add_history — Adds a line to the history
  - readline_callback_handler_install — Initializes the readline callback interface and terminal, prints the prompt and returns immediately
  - readline_callback_handler_remove — Removes a previously installed callback handler and restores terminal settings
  - readline_callback_read_char — Reads a character and informs the readline callback interface when a line is received
  - readline_clear_history — Clears the history
  - readline_completion_function — Registers a completion function
  - readline_info — Gets/sets various internal readline variables
  - readline_list_history — Lists the history
  - readline_on_new_line — Inform readline that the cursor has moved to a new line
  - readline_read_history — Reads the history
  - readline_redisplay — Redraws the display
  - readline_write_history — Writes the history

`↑` and `↓` to navigate • `Enter` to select • `Esc` to close • `/` to open