Skip to content

AdamHebby/php-scrollable-selection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP Scrollable Selection

Latest Stable Version Total Downloads Latest Unstable Version License

Allows a user to select an option from a scrollable list, returns key selected from original array input

Loop Mode

Single List Mode

Custom Colors & Cursor Text

Available Colors

Installation

composer require adamhebby/php-scrollable-selection

Example

require __DIR__ . '/vendor/autoload.php';
use AdamHebby\ScrollableSelection;

$list = array();

for ($i=1; $i < 50; $i++) {
    $list[] = "$i " . str_repeat('-', 20);
}

$ScrollableSelection = new ScrollableSelection(
    [
        'list'     => $list,
        'maxItems' => 10,
        'loops'    => true,
        'startKey' => 0,
        'cursor'   => '>',
        'colors'   => [
            'active'   => 'white',
            'inactive' => 'dark_gray'
        ]
    ]
);

$key = $ScrollableSelection->displayList();

if (!isset($list[$key])) {
    echo "User quit selection \n\n";
} else {
    echo "\nUser selected {$list[$key]} \n\n";
}

About

PHP Scrollable user selection list

Resources

License

Stars

Watchers

Forks

Packages

No packages published