walkboy / yii2-ajax-progress-bar
Bootstrap progress bar widget with updating thru ajax feature for yii2
Installs: 3 342
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- yiisoft/yii2: ^2.0
- yiisoft/yii2-bootstrap4: *
This package is auto-updated.
Last update: 2025-04-29 01:11:51 UTC
README
Boostrap 4 progress bar widget with ability to update percent value by periodic ajax request.
Installation
composer require walkboy/yii2-ajax-progress-bar:dev-master
Usage
In your view:
<?= \walkboy\ProgressBar\ProgressBar::widget([ 'bars' => [ [ 'percent' => $model->progressPercent, // initial percent 'label' => $model->progressPercent.' %', // initial label 'options' => ['class' => 'progress-bar-primary progress-bar-animated progress-bar-striped'], ], ], 'url' => ['controller/some-progress', 'id' => $model->id], // 'period' => '10', // how often update request will be send (default 5 sec) ]) ?>
In your controller:
function actionSomeProgress($id) { $model = $this->findModel($id); return [ 'percent' => $model->progressPercent, 'label' => $model->progressPercent.' %', ]; }