php - Error creating progress bar Laravel 5.0 Artisan Commands -
i trying create progress bar in artisan command. version of laravel using 5.0 (although has been updated 4.x commands stored in folder app/console/commands , in namespace foundry\phonehome\console\commands)
i running $this->output->progressstart($count); , have tried $this->output->createprogressbar($count); both of them error [symfony\component\debug\exception\fatalerrorexception] call undefined method symfony\component\console\output\consoleoutput::progressstart()
am doing wrong or progress bars not supported in laravel 5.0?
progress bars entered in laravel 5.1, can upgrade laravel (recommended) or writing simple progress bar yourself.
inside command, add following function:
private function updateprogress($done, $total) { $perc = floor(($done / $total) * 50); $left = 50 - $perc; $write = sprintf("\033[0g\033[2k[%'={$perc}s>%-{$left}s] - $perc%% - $done/$total", "", ""); fwrite(stderr, $write); } public function handle() { // logic $this->updateprogress(1,10); } you can see more implementations here command line progress bar in php
Comments
Post a Comment