PHPackages                             crumbls/laravel-cli-table - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. crumbls/laravel-cli-table

ActiveLibrary[CLI &amp; Console](/categories/cli)

crumbls/laravel-cli-table
=========================

A Laravel package providing a selectable console table with arrow key navigation

v1.0.1(11mo ago)02MITPHPPHP ^8.2

Since Jul 21Pushed 11mo agoCompare

[ Source](https://github.com/Crumbls/laravel-cli-table)[ Packagist](https://packagist.org/packages/crumbls/laravel-cli-table)[ RSS](/packages/crumbls-laravel-cli-table/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (5)Versions (3)Used By (0)

Laravel CLI Table
=================

[](#laravel-cli-table)

A powerful Laravel package that brings interactive, selectable console tables to your Artisan commands. Navigate through data with arrow keys, customize colors, and build better CLI experiences.

Why Use This Package?
---------------------

[](#why-use-this-package)

Building interactive CLI tools shouldn't be complicated. This package extends Symfony's robust Console Table with navigation and selection capabilities, giving you the power to create professional command-line interfaces with just a few lines of code.

Features
--------

[](#features)

- **Interactive Navigation** - Arrow key navigation through table rows
- **Customizable Colors** - Match your application's theme
- **Symfony Foundation** - Built on Symfony Console Table (all original features included)
- **Laravel Integration** - Works seamlessly with Artisan commands
- **Cross-Platform** - Supports macOS, Linux, and Windows terminals
- **Zero Configuration** - Works out of the box

Installation
------------

[](#installation)

```
composer require crumbls/laravel-cli-table
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

```
use Crumbls\LaravelCliTable\SelectableTable;

class YourCommand extends Command
{
    public function handle()
    {
        $table = new SelectableTable($this->output);

        $table->setHeaders(['ID', 'Name', 'Email']);
        $table->setRows([
            ['1', 'John Doe', 'john@example.com'],
            ['2', 'Jane Smith', 'jane@example.com'],
            ['3', 'Bob Johnson', 'bob@example.com'],
        ]);

        // Interactive mode - returns selected row data
        $selectedRow = $table->selectRow();

        if ($selectedRow) {
            $this->info("Selected: " . $selectedRow[1]); // John Doe, Jane Smith, etc.
        }
    }
}
```

### With Callback

[](#with-callback)

```
$selectedData = $table->selectRow(function($row, $index) {
    return [
        'index' => $index,
        'data' => $row,
        'id' => $row[0]
    ];
});
```

### Non-Interactive Mode

[](#non-interactive-mode)

```
$table->setInteractive(false);
$table->render();
```

### Customizing Selection Colors

[](#customizing-selection-colors)

```
// Set both colors at once
$table->setSelectedColors('green', 'white');

// Or set them individually
$table->setSelectedBackgroundColor('magenta');
$table->setSelectedForegroundColor('yellow');

// Available colors: black, red, green, yellow, blue, magenta, cyan, white
```

Controls
--------

[](#controls)

- **↑/↓ Arrow Keys**: Navigate up and down
- **Enter**: Select current row
- **Escape**: Exit without selection
- **Ctrl+C**: Force exit

Testing
-------

[](#testing)

```
# Run safe tests (non-interactive)
composer test

# Run all tests (may hang on interactive tests)
composer test-all

# Run PHPStan analysis
composer phpstan

# Check code coverage
composer test-coverage
```

Requirements
------------

[](#requirements)

- PHP ^8.2
- Laravel ^12.0
- Symfony Console ^7.2

Advanced Usage
--------------

[](#advanced-usage)

### Building Interactive Menus

[](#building-interactive-menus)

```
class SelectUserCommand extends Command
{
    public function handle()
    {
        $users = User::all(['id', 'name', 'email', 'status']);

        $table = new SelectableTable($this->output);
        $table->setHeaders(['ID', 'Name', 'Email', 'Status'])
              ->setRows($users->toArray())
              ->setSelectedColors('blue', 'white');

        $selected = $table->selectRow(function($row, $index) {
            return User::find($row[0]);
        });

        if ($selected) {
            $this->info("Selected user: {$selected->name}");
        }
    }
}
```

### Adding Action Rows

[](#adding-action-rows)

```
use Symfony\Component\Console\Helper\TableCell;

$table->addRow(['1', 'John Doe', 'john@example.com', 'Active']);
$table->addRow(['2', 'Jane Smith', 'jane@example.com', 'Active']);
$table->addRow([new TableCell('+ Add New User', ['colspan' => 4])]);
```

### Translations

[](#translations)

The package includes translatable strings for instructions and messages. Publish the language files:

```
php artisan vendor:publish --tag=cli-table-lang
```

Then customize the translations in `lang/vendor/cli-table/en/table.php`:

```
return [
    'instructions' => 'Use ↑/↓ arrows to navigate, Enter to select, q/Esc to exit',
    'selected_row' => 'Selected Row: :current/:total',
    'selection_cancelled' => 'Selection cancelled',
    // Add your own translations...
];
```

Troubleshooting
---------------

[](#troubleshooting)

### Arrow Keys Not Working?

[](#arrow-keys-not-working)

- Ensure your terminal supports ANSI escape sequences
- Try using a modern terminal (Terminal.app, iTerm2, Windows Terminal)
- Some older terminals may not support interactive features

### Colors Not Displaying?

[](#colors-not-displaying)

- Your terminal may not support color output
- Try different color combinations: `red`, `green`, `blue`, `yellow`, `magenta`, `cyan`, `white`, `black`

Support
-------

[](#support)

Need help or found a bug? We're here to help!

- **Report Issues**: [GitHub Issues](https://github.com/crumbls/laravel-cli-table/issues)
- **Get Help**: Join our [Discord Community](https://discord.com/channels/1389657726531145848/1396936001942978591)
- **Documentation**: Check out the examples above and in the `/tests` directory

Contributing
------------

[](#contributing)

We welcome contributions! Please feel free to submit pull requests or open issues to help improve this package.

Commercial Use
--------------

[](#commercial-use)

We love seeing how this package is used! If you're using Laravel CLI Table in a commercial application, we'd appreciate a postcard from your city:

```
Crumbls
PO Box 15
Lafayette, CO 80026
USA

```

Requirements
------------

[](#requirements-1)

- PHP ^8.2
- Laravel ^12.0
- Symfony Console ^7.2

License
-------

[](#license)

MIT - feel free to use this package in your personal and commercial projects.

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance51

Moderate activity, may be stable

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

347d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3020753?v=4)[Chase C. Miller](/maintainers/chasecmiller)[@chasecmiller](https://github.com/chasecmiller)

---

Top Contributors

[![chasecmiller](https://avatars.githubusercontent.com/u/3020753?v=4)](https://github.com/chasecmiller "chasecmiller (3 commits)")

###  Code Quality

TestsPest

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/crumbls-laravel-cli-table/health.svg)

```
[![Health](https://phpackages.com/badges/crumbls-laravel-cli-table/health.svg)](https://phpackages.com/packages/crumbls-laravel-cli-table)
```

###  Alternatives

[laravel/octane

Supercharge your Laravel application's performance.

4.0k26.6M223](/packages/laravel-octane)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
