Skip to content

Instantly share code, notes, and snippets.

@artemrogov
Created May 6, 2016 21:25
Show Gist options
  • Save artemrogov/84b7ff6f68c20ffc0b54caa54ca053d7 to your computer and use it in GitHub Desktop.
Save artemrogov/84b7ff6f68c20ffc0b54caa54ca053d7 to your computer and use it in GitHub Desktop.
консольный прогресс бар для YII2
<?php
namespace console\controllers;
use yii\console\Controller;
use yii\helpers\Console;
class ProgressController extends Controller {
public function actionIndex(){
$result = $this->prompt("запуск прогресс бара: ");
if($result=="yes"){
Console::startProgress(0,100);
foreach(range(0,100) as $v){
usleep(100);
Console::updateProgress($v,100);
}
Console::endProgress("end".PHP_EOL);
}
else {
echo 'Вы ввели неверную команду!';
}
return parent::EXIT_CODE_NORMAL;
}
}
@artemrogov
Copy link
Author

artemrogov commented May 6, 2016

Запускает прогресс бар, первая консольная программка на php
Запустить консольную утилиту, можно: php yii progress

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment