phpnt/yii2-icheck
Composer 安装命令:
composer require phpnt/yii2-icheck
包简介
Yii2 ICheck
README 文档
README
Описание:
Стилизованный чекбоксы и радиокнопки.
DEMO
- Поддержать phpNT
Социальные сети:
Установка:
php composer.phar require "phpnt/yii2-icheck" "*"
или
composer require phpnt/yii2-icheck
или добавить в composer.json файл
"phpnt/yii2-icheck": "*"
Представление:
use phpnt\ICheck\ICheck;
<h3>STYLE_MIMIMAL (цвета для STYLE_MIMIMAL - minimal (черный), red, green, blue, aero, grey, orange, yellow, pink, purple)</h3> <div class="col-md-6"> <?= $form->field($model, 'checkbox', ['template' => '{label} {input}'])->widget(ICheck::className(), [ 'type' => ICheck::TYPE_CHECBOX, 'style' => ICheck::STYLE_MIMIMAL, 'color' => 'green' // цвет ]) ?> <?= $form->field($model, 'checkbox2')->widget(ICheck::className(), [ 'type' => ICheck::TYPE_CHECBOX_LIST, 'style' => ICheck::STYLE_MIMIMAL, 'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'], 'color' => 'minimal', // цвет 'options' => [ 'item' => function ($index, $label, $name, $checked, $value){ return '<input type="checkbox" id="check-1-'.$index.'" name="'.$name.'" value="'.$value.'" '.($checked ? 'checked' : false).'> <label for="check-1-'.$index.'">'.$label.'</label><br>'; } ]]) ?> <?= $form->field($model, 'checkbox3')->widget(ICheck::className(), [ 'type' => ICheck::TYPE_CHECBOX_LIST, 'style' => ICheck::STYLE_MIMIMAL, 'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'], 'color' => 'red', // цвет 'options' => [ 'item' => function ($index, $label, $name, $checked, $value){ return '<input type="checkbox" id="check-2-'.$index.'" name="'.$name.'" value="'.$value.'" '.($checked ? 'checked' : false).'> <label for="check-2-'.$index.'">'.$label.'</label>'; } ]]) ?> </div> <div class="col-md-6"> <?= $form->field($model, 'radio')->widget(ICheck::className(), [ 'type' => ICheck::TYPE_RADIO, 'style' => ICheck::STYLE_MIMIMAL, 'color' => 'green' // цвет ]) ?> <?= $form->field($model, 'radio2')->widget(ICheck::className(), [ 'type' => ICheck::TYPE_RADIO_LIST, 'style' => ICheck::STYLE_MIMIMAL, 'items' => [1 => 'Вася2', 2 => 'Катя2', 3 => 'Жора'], 'color' => 'purple', // цвет 'options' => [ 'item' => function ($index, $label, $name, $checked, $value){ return '<input type="radio" id="check-3-'.$index.'" name="'.$name.'" value="'.$value.'" '.($checked ? 'checked' : false).'> <label for="check-3-'.$index.'">'.$label.'</label><br>'; } ]]) ?> <?= $form->field($model, 'radio3')->widget(ICheck::className(), [ 'type' => ICheck::TYPE_RADIO_LIST, 'style' => ICheck::STYLE_MIMIMAL, 'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'], 'color' => 'blue', // цвет 'options' => [ 'item' => function ($index, $label, $name, $checked, $value){ return '<input type="radio" id="check-4-'.$index.'" name="'.$name.'" value="'.$value.'" '.($checked ? 'checked' : false).'> <label for="check-4-'.$index.'">'.$label.'</label>'; } ]]) ?> </div> <h3>STYLE_SQUARE (цвета для STYLE_SQUARE - square (черный), red, green, blue, aero, grey, orange, yellow, pink, purple)</h3> <div class="col-md-6"> <?= $form->field($model, 'checkbox4', ['template' => '{label} {input}'])->widget(ICheck::className(), [ 'type' => ICheck::TYPE_CHECBOX, 'style' => ICheck::STYLE_SQUARE, 'color' => 'square' // цвет ]) ?> <?= $form->field($model, 'checkbox5')->widget(ICheck::className(), [ 'type' => ICheck::TYPE_CHECBOX_LIST, 'style' => ICheck::STYLE_SQUARE, 'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'], 'color' => 'green', // цвет 'options' => [ 'item' => function ($index, $label, $name, $checked, $value){ return '<input type="checkbox" id="check-5-'.$index.'" name="'.$name.'" value="'.$value.'" '.($checked ? 'checked' : false).'> <label for="check-5-'.$index.'">'.$label.'</label>'; } ]]) ?> <?= $form->field($model, 'checkbox6')->widget(ICheck::className(), [ 'type' => ICheck::TYPE_CHECBOX_LIST, 'style' => ICheck::STYLE_SQUARE, 'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'], 'color' => 'red', // цвет 'options' => [ 'item' => function ($index, $label, $name, $checked, $value){ return '<input type="checkbox" id="check-6-'.$index.'" name="'.$name.'" value="'.$value.'" '.($checked ? 'checked' : false).'> <label for="check-6-'.$index.'">'.$label.'</label><br>'; } ]]) ?> </div> <div class="col-md-6"> <?= $form->field($model, 'radio4')->widget(ICheck::className(), [ 'type' => ICheck::TYPE_RADIO, 'style' => ICheck::STYLE_SQUARE, 'color' => 'blue' // цвет ]) ?> <?= $form->field($model, 'radio5')->widget(ICheck::className(), [ 'type' => ICheck::TYPE_RADIO_LIST, 'style' => ICheck::STYLE_SQUARE, 'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'], 'color' => 'yellow', // цвет 'options' => [ 'item' => function ($index, $label, $name, $checked, $value){ return '<input type="radio" id="check-7-'.$index.'" name="'.$name.'" value="'.$value.'" '.($checked ? 'checked' : false).'> <label for="check-7-'.$index.'">'.$label.'</label><br>'; } ]]) ?> <?= $form->field($model, 'radio6')->widget(ICheck::className(), [ 'type' => ICheck::TYPE_RADIO_LIST, 'style' => ICheck::STYLE_SQUARE, 'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'], 'color' => 'aero', // цвет 'options' => [ 'item' => function ($index, $label, $name, $checked, $value){ return '<input type="radio" id="check-8-'.$index.'" name="'.$name.'" value="'.$value.'" '.($checked ? 'checked' : false).'> <label for="check-8-'.$index.'">'.$label.'</label>'; } ]]) ?> </div> <h3>STYLE_FLAT (цвета для STYLE_SQUARE - flat (черный), red, green, blue, aero, grey, orange, yellow, pink, purple)</h3> <div class="col-md-6"> <?= $form->field($model, 'checkbox7', ['template' => '{label} {input}'])->widget(ICheck::className(), [ 'type' => ICheck::TYPE_CHECBOX, 'style' => ICheck::STYLE_FLAT, 'color' => 'flat' // цвет ]) ?> <?= $form->field($model, 'checkbox8')->widget(ICheck::className(), [ 'type' => ICheck::TYPE_CHECBOX_LIST, 'style' => ICheck::STYLE_FLAT, 'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'], 'color' => 'green', // цвет 'options' => [ 'item' => function ($index, $label, $name, $checked, $value){ return '<input type="checkbox" id="check-9-'.$index.'" name="'.$name.'" value="'.$value.'" '.($checked ? 'checked' : false).'> <label for="check-9-'.$index.'">'.$label.'</label>'; } ]]) ?> <?= $form->field($model, 'checkbox9')->widget(ICheck::className(), [ 'type' => ICheck::TYPE_CHECBOX_LIST, 'style' => ICheck::STYLE_FLAT, 'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'], 'color' => 'red', // цвет 'options' => [ 'item' => function ($index, $label, $name, $checked, $value){ return '<input type="checkbox" id="check-10-'.$index.'" name="'.$name.'" value="'.$value.'" '.($checked ? 'checked' : false).'> <label for="check-10-'.$index.'">'.$label.'</label><br>'; } ]]) ?> </div> <div class="col-md-6"> <?= $form->field($model, 'radio7')->widget(ICheck::className(), [ 'type' => ICheck::TYPE_RADIO, 'style' => ICheck::STYLE_FLAT, 'color' => 'blue' // цвет ]) ?> <?= $form->field($model, 'radio8')->widget(ICheck::className(), [ 'type' => ICheck::TYPE_RADIO_LIST, 'style' => ICheck::STYLE_FLAT, 'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'], 'color' => 'yellow', // цвет 'options' => [ 'item' => function ($index, $label, $name, $checked, $value){ return '<input type="radio" id="radio-7-'.$index.'" name="'.$name.'" value="'.$value.'" '.($checked ? 'checked' : false).'> <label for="radio-7-'.$index.'">'.$label.'</label><br>'; } ]]) ?> <?= $form->field($model, 'radio9')->widget(ICheck::className(), [ 'type' => ICheck::TYPE_RADIO_LIST, 'style' => ICheck::STYLE_FLAT, 'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'], 'color' => 'aero', // цвет 'options' => [ 'item' => function ($index, $label, $name, $checked, $value){ return '<input type="radio" id="radio-8-'.$index.'" name="'.$name.'" value="'.$value.'" '.($checked ? 'checked' : false).'> <label for="radio-8-'.$index.'">'.$label.'</label>'; } ]]) ?> </div> <h3>STYLE_LINE (цвета для STYLE_LINE - line (черный), red, green, blue, aero, grey, orange, yellow, pink, purple)</h3> <div class="col-md-6"> <?= $form->field($model, 'checkbox10')->widget(ICheck::className(), [ 'type' => ICheck::TYPE_CHECBOX_LIST, 'style' => ICheck::STYLE_LINE, 'items' => [1 => 'Вася'], 'color' => 'yellow', // цвет 'options' => [ 'item' => function ($index, $label, $name, $checked, $value){ return '<input type="checkbox" id="check-10-'.$index.'" name="'.$name.'" value="'.$value.'" '.($checked ? 'checked' : false).'> <label for="check-7-'.$index.'">'.$label.'</label>'; }, ]]) ?> <?= $form->field($model, 'checkbox11')->widget(ICheck::className(), [ 'type' => ICheck::TYPE_CHECBOX_LIST, 'style' => ICheck::STYLE_LINE, 'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'], 'color' => 'red', // цвет 'options' => [ 'item' => function ($index, $label, $name, $checked, $value){ return '<input type="checkbox" id="check-11-'.$index.'" name="'.$name.'" value="'.$value.'" '.($checked ? 'checked' : false).'> <label for="check-7-'.$index.'">'.$label.'</label>'; }, ]]) ?> </div> <div class="col-md-6"> <?= $form->field($model, 'radio10')->widget(ICheck::className(), [ 'type' => ICheck::TYPE_RADIO_LIST, 'style' => ICheck::STYLE_LINE, 'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'], 'color' => 'pink', // цвет 'options' => [ 'item' => function ($index, $label, $name, $checked, $value){ return '<input type="radio" id="radio-10-'.$index.'" name="'.$name.'" value="'.$value.'" '.($checked ? 'checked' : false).'> <label for="check-7-'.$index.'">'.$label.'</label>'; }, ]]) ?> </div> <h3>STYLE_POLARIS</h3> <div class="col-md-6" style="background-color: #2c323c; padding: 20px;"> <?= $form->field($model, 'checkbox12', ['template' => '{label} {input}'])->widget(ICheck::className(), [ 'type' => ICheck::TYPE_CHECBOX, 'style' => ICheck::STYLE_POLARIS, ]) ?> <?= $form->field($model, 'checkbox13')->widget(ICheck::className(), [ 'type' => ICheck::TYPE_CHECBOX_LIST, 'style' => ICheck::STYLE_POLARIS, 'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'], 'options' => [ 'item' => function ($index, $label, $name, $checked, $value){ return '<input type="checkbox" id="check-13-'.$index.'" name="'.$name.'" value="'.$value.'" '.($checked ? 'checked' : false).'> <label for="check-13-'.$index.'">'.$label.'</label>'; } ]]) ?> <?= $form->field($model, 'checkbox14')->widget(ICheck::className(), [ 'type' => ICheck::TYPE_CHECBOX_LIST, 'style' => ICheck::STYLE_POLARIS, 'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'], 'options' => [ 'item' => function ($index, $label, $name, $checked, $value){ return '<input type="checkbox" id="check-14-'.$index.'" name="'.$name.'" value="'.$value.'" '.($checked ? 'checked' : false).'> <label for="check-14-'.$index.'">'.$label.'</label><br>'; } ]]) ?> </div> <div class="col-md-6" style="background-color: #2c323c; padding: 20px;"> <?= $form->field($model, 'radio11')->widget(ICheck::className(), [ 'type' => ICheck::TYPE_RADIO, 'style' => ICheck::STYLE_POLARIS, ]) ?> <?= $form->field($model, 'radio12')->widget(ICheck::className(), [ 'type' => ICheck::TYPE_RADIO_LIST, 'style' => ICheck::STYLE_POLARIS, 'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'], 'options' => [ 'item' => function ($index, $label, $name, $checked, $value){ return '<input type="radio" id="radio-12-'.$index.'" name="'.$name.'" value="'.$value.'" '.($checked ? 'checked' : false).'> <label for="radio-12-'.$index.'">'.$label.'</label><br>'; } ]]) ?> <?= $form->field($model, 'radio13')->widget(ICheck::className(), [ 'type' => ICheck::TYPE_RADIO_LIST, 'style' => ICheck::STYLE_POLARIS, 'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'], 'options' => [ 'item' => function ($index, $label, $name, $checked, $value){ return '<input type="radio" id="radio-13-'.$index.'" name="'.$name.'" value="'.$value.'" '.($checked ? 'checked' : false).'> <label for="radio-13-'.$index.'">'.$label.'</label>'; } ]]) ?> </div> <h3>STYLE_FUTURICO</h3> <div class="col-md-6" style="background-color: #2c323c; padding: 20px;"> <?= $form->field($model, 'checkbox15', ['template' => '{label} {input}'])->widget(ICheck::className(), [ 'type' => ICheck::TYPE_CHECBOX, 'style' => ICheck::STYLE_FUTURICO, ]) ?> <?= $form->field($model, 'checkbox16')->widget(ICheck::className(), [ 'type' => ICheck::TYPE_CHECBOX_LIST, 'style' => ICheck::STYLE_FUTURICO, 'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'], 'options' => [ 'item' => function ($index, $label, $name, $checked, $value){ return '<input type="checkbox" id="check-16-'.$index.'" name="'.$name.'" value="'.$value.'" '.($checked ? 'checked' : false).'> <label for="check-16-'.$index.'">'.$label.'</label>'; } ]]) ?> <?= $form->field($model, 'checkbox17')->widget(ICheck::className(), [ 'type' => ICheck::TYPE_CHECBOX_LIST, 'style' => ICheck::STYLE_FUTURICO, 'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'], 'options' => [ 'item' => function ($index, $label, $name, $checked, $value){ return '<input type="checkbox" id="check-17-'.$index.'" name="'.$name.'" value="'.$value.'" '.($checked ? 'checked' : false).'> <label for="check-17-'.$index.'">'.$label.'</label><br>'; } ]]) ?> </div> <div class="col-md-6" style="background-color: #2c323c; padding: 20px;"> <?= $form->field($model, 'radio14')->widget(ICheck::className(), [ 'type' => ICheck::TYPE_RADIO, 'style' => ICheck::STYLE_FUTURICO, ]) ?> <?= $form->field($model, 'radio15')->widget(ICheck::className(), [ 'type' => ICheck::TYPE_RADIO_LIST, 'style' => ICheck::STYLE_FUTURICO, 'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'], 'options' => [ 'item' => function ($index, $label, $name, $checked, $value){ return '<input type="radio" id="radio-15-'.$index.'" name="'.$name.'" value="'.$value.'" '.($checked ? 'checked' : false).'> <label for="radio-15-'.$index.'">'.$label.'</label><br>'; } ]]) ?> <?= $form->field($model, 'radio16')->widget(ICheck::className(), [ 'type' => ICheck::TYPE_RADIO_LIST, 'style' => ICheck::STYLE_FUTURICO, 'items' => [1 => 'Вася', 2 => 'Катя', 3 => 'Жора'], 'options' => [ 'item' => function ($index, $label, $name, $checked, $value){ return '<input type="radio" id="radio-16-'.$index.'" name="'.$name.'" value="'.$value.'" '.($checked ? 'checked' : false).'> <label for="radio-16-'.$index.'">'.$label.'</label>'; } ]]) ?> </div>
Документация:
ICheck
Лицензия:
MIT
phpnt/yii2-icheck 适用场景与选型建议
phpnt/yii2-icheck 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 16.79k 次下载、GitHub Stars 达 7, 最近一次更新时间为 2017 年 05 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「yii2」 「iCheck」 「phpnt」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 phpnt/yii2-icheck 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 phpnt/yii2-icheck 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 phpnt/yii2-icheck 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Yii2 asset for bower iCheck
Yii2 chartjs
Yii2 Metis Menu
A custom URL rule class for Yii 2 which allows to create translated URL rules
Yii2 中使用 iCheck
Yii2 Yandex Map widget
统计信息
- 总下载量: 16.79k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 5
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-05-01