you need to assign $outpiut to ConsoleOutput class
use Symfony\Component\Console\Output\ConsoleOutput; $output = new ConsoleOutput(); $progress = new ProgressBar($output, 50); like this it will work fine now
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
When use Progress Bar on console command not problem But I like use on other classes.
I've a command MigrateDatabases.php This command use one clase MigrateTables On this class when try to use progress bars on MigrateTables.php get error
use Illuminate\Support\Facades\Config;
use DB;
...
$bar = $this->output->createProgressBar(DB::connection('mysql_old')->table($db)->count());
When run my console command get error
php artisan migratedb:migrate table --table=cms_users
[ErrorException]
Undefined property: Abkrim\Setdart\MigrateTables::$output
Try read and use some examples of http://symfony.com/doc/2.7/components/console/helpers/progressbar.html but get other error.
I understand $output parameter on ProgressBar constructor.
use Symfony\Component\Console\Helper\ProgressBar;
...
// create a new progress bar (50 units)
$progress = new ProgressBar($output, 50);
Please or to participate in this conversation.