hauntd/yii2-vote
Composer 安装命令:
composer require hauntd/yii2-vote
包简介
Votes, likes, favorites.
关键字:
README 文档
README
This module allows you to attach vote widgets, like/favorite buttons to your models.
- Attach as many widgets to model as you need
- Customization (action, events, views)
- Useful widgets included (Favorite button, Like button, Rating "up/down")
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist hauntd/yii2-vote "0.3.*"
or add
"hauntd/yii2-vote": "*"
to the require section of your composer.json file.
Configuration
Add module settings to your application config (config/main.php).
Entity names should be in camelCase like itemVote, itemVoteGuests, itemLike and itemFavorite.
return [ 'modules' => [ 'vote' => [ 'class' => hauntd\vote\Module::class, 'guestTimeLimit' => 3600, 'entities' => [ // Entity -> Settings 'itemVote' => app\models\Item::class, // your model 'itemVoteGuests' => [ 'modelName' => app\models\Item::class, // your model 'allowGuests' => true, 'allowSelfVote' => false, 'entityAuthorAttribute' => 'user_id', ], 'itemLike' => [ 'modelName' => app\models\Item::class, // your model 'type' => hauntd\vote\Module::TYPE_TOGGLE, // like/favorite button ], 'itemFavorite' => [ 'modelName' => app\models\Item::class, // your model 'type' => hauntd\vote\Module::TYPE_TOGGLE, // like/favorite button ], ], ], ], 'components' => [ ... ] ];
After you downloaded and configured hauntd/yii2-vote, the last thing you need to do is updating your database schema by applying the migrations:
php yii migrate/up --migrationPath=@vendor/hauntd/yii2-vote/migrations/
Usage
Vote widget:
<?= \hauntd\vote\widgets\Vote::widget([ 'entity' => 'itemVote', 'model' => $model, 'options' => ['class' => 'vote vote-visible-buttons'] ]); ?>
Like/Favorite widgets:
<?= \hauntd\vote\widgets\Favorite::widget([ 'entity' => 'itemFavorite', 'model' => $model, ]); ?> <?= \hauntd\vote\widgets\Like::widget([ 'entity' => 'itemLike', 'model' => $model, ]); ?>
Change log
Please see CHANGELOG for more information what has changed recently.
Documentation
License
BSD 3-Clause License. Please see License File for more information.
hauntd/yii2-vote 适用场景与选型建议
hauntd/yii2-vote 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.19k 次下载、GitHub Stars 达 38, 最近一次更新时间为 2016 年 07 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「module」 「likes」 「votes」 「yii2」 「Favorites」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 hauntd/yii2-vote 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hauntd/yii2-vote 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 hauntd/yii2-vote 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Likes for NetCommons Plugin
A Laravel package to create polls
Top Like Givers in the past month Widget.
Page assessment feature for your Yii2 application based on Vue2.
bootstrap select field module implementing http://silviomoreto.github.io/bootstrap-select/
Manage user favorites in laravel application.
统计信息
- 总下载量: 3.19k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 40
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2016-07-01
