Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Php Cli Tools Laravel Package

wp-cli/php-cli-tools

PHP Command Line Tools is a collection of functions and classes for building command-line apps in PHP. It provides formatted output, input prompts, menus, progress indicators, ASCII tables, tree displays, and argument parsing. Requires PHP 5.6 or newer.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Standardization of CLI Workflows: Unifies output formatting, user prompts, and progress indicators across Laravel/PHP CLI tools, reducing inconsistencies in logging, error handling, and user interactions.
  • Build vs. Buy for CLI Utilities: Eliminates the need to build custom solutions for:
    • Progress Tracking: Replace manual echo loops with cli\progress\Bar() for consistent progress bars in Laravel migrations or queue workers.
    • Tabular Data: Standardize API response logging or database inspection outputs using cli\Table (e.g., php artisan db:inspect). As of v0.13.2, table rows can be populated directly from an iterator/generator, enabling streaming of large or lazily-loaded result sets (e.g., cursor-based DB queries, paginated API dumps) into a table without materializing everything in memory first.
    • User Input: Add interactive prompts (e.g., cli\prompt()) to Laravel Artisan commands for configuration or confirmation steps.
  • Use Cases:
    • Debugging Tools: Integrate cli\Tree to visualize Laravel service container bindings or route hierarchy.
    • CI/CD Enhancements: Use cli\notify\Spinner for async task feedback in deployment scripts.
    • Legacy System Modernization: Migrate monolithic PHP scripts to modular CLI tools with structured output (e.g., cli\out_padded() for aligned logs).
    • Large-Data Inspection: Stream rows from Eloquent cursor(), generators, or paginated APIs straight into cli\Table using the new iterator support, keeping memory footprint flat for large datasets.

When to Consider This Package

  • Adopt if:
    • Your Laravel project requires consistent CLI output formatting (e.g., APIs, cron jobs, or Artisan commands with multi-line responses).
    • You need cross-platform CLI utilities (Windows/Linux/macOS compatibility is actively maintained).
    • Your team uses PHP 5.6+ and wants to avoid reinventing wheel for:
      • Progress bars, tables, or tree structures.
      • User prompts/interactive workflows.
      • Argument parsing for complex CLI tools.
    • You’re building internal tools (e.g., Laravel admin dashboards, deployment scripts) where UX matters.
    • You frequently render large or lazy-loaded datasets in tables and want to avoid building custom streaming/pagination logic (v0.13.2 iterator support).
  • Look elsewhere if:
    • Your stack is pure Symfony/Laravel with no CLI needs—use Symfony’s Console component instead.
    • You require modern PHP 8.3+ features: This package prioritizes backward compatibility (PHP 5.6+) over cutting-edge syntax.
    • Your team prefers alternative libraries (e.g., symfony/console, league/cli-table, spatie/cli).
    • You’re not using Composer: The package assumes Composer-based dependency management.

How to Pitch It (Stakeholders)

For Executives:

"This package lets us standardize and elevate our CLI tools—think of it as ‘Tailwind CSS for PHP command line output.’

  • Reduce DevOps noise: Replace fragmented echo statements in scripts with consistent, reusable output (tables, progress bars, prompts).
  • Improve UX for internal tools: If your team uses Laravel Artisan for admin tasks, this adds polished, interactive workflows (e.g., confirmations, menus).
  • Future-proof CI/CD: Integrate cli\progress\Bar into deployment scripts to visually track long-running tasks (e.g., database migrations). It’s a low-code, high-impact way to modernize our tooling without hiring extra engineers."

For Engineering:

"This gives us WP-CLI’s battle-tested CLI utilities—but without the WordPress dependency. Key wins:

  • Progress bars: Replace for loops with cli\progress\Bar for migrations/queue workers (e.g., php artisan migrate --progress).
  • Tabular output: Standardize API response logging or tinker inspection with cli\Table (auto-detects piped output for scripts). v0.13.2 adds iterator-backed rows, so we can stream from cursor(), generators, or paginated APIs without buffering the whole result set.
  • Interactive prompts: Add cli\prompt() to Artisan commands for user confirmation (e.g., php artisan deploy --confirm).
  • Cross-platform: Works on Windows/Linux/macOS (unlike some Symfony tools). Downside: It’s not Laravel-native, but the abstraction layer is minimal. For most CLI needs, this is better than rolling our own."*

For Developers:

"If you’re tired of writing custom echo loops or hacking together progress bars, this package saves hours. Example:

// Before: Manual progress bar (error-prone)
for ($i = 0; $i < 100; $i++) {
    echo str_repeat('=', $i) . '>' . str_repeat(' ', 100 - $i) . "\r";
}

// After: One-liner with `cli\progress\Bar`
$bar = new \cli\progress\Bar('Processing...', 100);
while ($bar->tick()) { /* ... */ }

New in v0.13.2: feed a table from any iterator—no array preloading:

$table = new \cli\Table();
$table->setHeaders(['ID', 'Name']);
$table->setRows(User::query()->cursor()); // streams rows
$table->display();

It’s MIT-licensed, actively maintained, and used by WP-CLI—so it’s battle-tested for real-world CLI apps."

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
ippanelcom/laravel-sdk
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus