ncurses-based menu widgets for PHP CLI scripts
PHP
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
CLInput.php
README.markdown
example.php

README.markdown

CLInput

A library for more robust command-line input from CLI PHP scripts.

Installation

CLInput requires the ncurses library for PHP. It's available here http://pecl.php.net/package/ncurses or via your package manager.

Usage

Prompt for an email address:

$email = $input->email();

Prompt for a password:

$password = $input->password();

Prompt for text that matches a validation function

$tommy = $input->text('Input the word tommy', function($result) {
    return $result == 'tommy';
}, 'I told you to input tommy');

Allow the user to select an option from a list:

$option = $input->select(array(
    'the first option',
    'another option',
    'or maybe you want this one?'
));

Check out example.php for a complete example.