New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

adamhebby/php-scrollable-selection

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adamhebby/php-scrollable-selection

PHP Scrollable user selection list

Source
Packagist
Version
v1.0.3
Version published
Total downloads
26
Maintainers
1
Created
Source

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";
}

FAQs

Package last updated on 30 Oct 2018

Related posts