PHP code example of maks757 / yii2-progress
1. Go to this page and download the library: Download maks757/yii2-progress library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
maks757 / yii2-progress example snippets
'components' => [
// Progress config
'progress' => [
'class' => \bl\progress\Progress::className(),
'validatorClass' => \bl\progress\components\ProgressComponent::className(),
'honors' => [
// name category
'userConfirm' => [
'class' => \bl\progress\components\ValidateProgress::className(), //class validator
'name' => 'Registration success', // name user progress
'image' => Yii::getAlias('@vendor/maks757/yii2-progress/image/user.png'), //path to image
'long_description' => '', // 255 chars
'short_description' => '', // 100 chars
]
]
],
// Images config
'imagableProgress' => [
'class' => 'bl\imagable\Imagable',
'imageClass' => \bl\progress\components\image\CreateImageImagine::className(),
'nameClass' => \bl\progress\components\image\GenerateName::className(),
'imagesPath' => '@webroot/progressImage',
'categories' => [
'category' => [
'progress' => [
'origin' => false,
'size' => [
'long' => [
'width' => 500,
'height' => 500,
],
'short' => [
'width' => 200,
'height' => 200,
],
]
],
]
]
],
// ...
]
/**
*@var Progress $progress
*/
$progress = Yii::$app->progress;
// First variant
// 1 param ( progress category )
// 2 param ( user id )
$progress->validateOne('userConfirm', 1);
// Second variant
// 1 param ( progress category )
// its use current user id
$progress->validate('userConfirm');
$userProgress = \bl\progress\entities\UserProgress::getUserProgress($userRegisterInfo->id);
foreach ($userProgress as $value)
{
/** *@var Progress $progress */
$progress = Yii::$app->progress;
$pathImage = $progress->getImage($value->image->image, 'progress', 'short');
$content = Html::tag('h3', $value->name);
$content .= Html::img($pathImage);
echo Html::tag('div', $content, ['class' => 'col-sm-2']);
}
php yii migrate --migrationPath=@vendor/maks757/yii2-progress/migrations