Laravel Packages

Partyline – A Package to Print to the Artisan Console From Anywhere

Published
Partyline – A Package to Print to the Artisan Console From Anywhere image

Partyline is a new package that allows you to output to the console from outside of command class. This allows you more control on how things are printed and is great for when you need to loop items and show progress or other insights.

Here is an example of a normal Command’s handle method that I grabbed from their announcement:

// Console command without Partyline
public function handle()
{
$this->line('Updating the index...');
 
Search::update(); // ¯\_(ツ)_/¯
 
$this->line('Surprise! It is finished!');
}

Inside the Search update() method it’s difficult to pass back feedback and with Partyline this can now include the following:

class Search
{
public function update()
{
Partyline::line('Updating the index...');
 
$entries = Entry::all();
 
$bar = Partyline::getOutput()->createProgressBar($entries->count());
 
foreach ($entries as $id => $entry) {
$this->index->insert($id, $entry);
$bar->advance();
}
 
$bar->finish();
Partyline::line('All done!');
}
}

Check out the annoncement and the Github repo for more details on this package.

Eric L. Barnes photo

Eric is the creator of Laravel News and has been covering Laravel since 2012.

Sponsored

serpapi logo
SerpApi

The Web Search API for Your LLM and AI Applications

Visit SerpApi

The latest

View all →
CPX: The Composer Package Executor for PHP image

CPX: The Composer Package Executor for PHP

Read article
Laravel AI SDK Adds Human-in-the-Loop Tool Approval image

Laravel AI SDK Adds Human-in-the-Loop Tool Approval

Read article
Pest 5 Released With Test Impact Analysis, Agent Verification, and Evals image

Pest 5 Released With Test Impact Analysis, Agent Verification, and Evals

Read article
Queue-SQL: Run Mass Deletes and Updates Across Parallel Queue Jobs image

Queue-SQL: Run Mass Deletes and Updates Across Parallel Queue Jobs

Read article
Blade Formatting in Laravel Pint image

Blade Formatting in Laravel Pint

Read article
Inertia DevTools Is Now on the Chrome Web Store image

Inertia DevTools Is Now on the Chrome Web Store

Read article