Weave Code
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

Partyline Laravel Package

wilderborn/partyline

Partyline adds lightweight, terminal-style feedback to your Laravel app. It helps you print and update messages, show progress, and display clean, interactive CLI output—handy for Artisan commands, long-running jobs, and scripts.

View on GitHub
Deep Wiki
Context7

Getting Started

Start by installing the package via Composer: composer require wilderborn/partyline. In your Artisan command, import the facade (use Wilderborn\Partyline\Facade as Partyline;) and begin prompting interactively. Your first use case is likely replacing manual ask()/confirm() calls—e.g., Partyline::ask('What’s your project name?') returns user input directly. For yes/no prompts, use Partyline::confirm('Proceed with deployment?'). All prompts respect Laravel’s console output buffering and integrate seamlessly with laravel new-style command flows.

Implementation Patterns

  • Sequential flows: Chain prompts for multi-step wizards (e.g., installers), returning early on failures or using guard clauses:
    $db = Partyline::ask('Database name?', 'myapp');
    if (!Partyline::confirm("Create database `$db`?")) return;
    
  • Choice validation: Use choice() with arrays and fallback defaults—Partyline::choice('Environment?', ['local', 'staging', 'production'], 'local') returns the selected value.
  • Styling output: Pair prompts with Partyline::success('✓ Done'), Partyline::warn('⚠ Skipping...'), or Partyline::error('✗ Failed') for consistent feedback.
  • Non-interactive fallback: Use Partyline::setInteractive(false) (e.g., in CI) to auto-answer with defaults or skip prompts gracefully.
  • Reusability: Wrap common patterns in helper methods inside your command class (e.g., askDatabaseConfig()) to keep handle() clean.

Gotchas and Tips

  • Laravel version dependency: Ensure compatibility with your Laravel version (this package targets Laravel 8+ based on 2022 release); check composer.json for required illuminate/console versions.
  • Non-interactive mode defaults: Without manual intervention, ask() returns the default value only if explicitly passed (e.g., ask('Name?', 'default')); omitting the default yields null. Always validate or fallback after prompts in production scripts.
  • Output buffering: Partyline writes directly to OutputInterface, so avoid mixing with manual output->line() calls unless styled consistently—use Partyline’s styling methods instead.
  • Testing commands: Mock Partyline::fake() in tests to assert prompts and inject responses without user interaction:
    Partyline::fake()
        ->expectPromptedWith('Name?')
        ->andThenAnswer('MyApp');
    
  • No confirmation echo: confirm() prompts return true/false but don’t echo the result—add explicit feedback via success/warn if needed.
  • No built-in password masking: For sensitive input like API keys, fall back to native $this->secret() (Partyline does not provide secret()).
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport