atm/pollbundle
Composer 安装命令:
composer require atm/pollbundle
包简介
Poll bundle
关键字:
README 文档
README
Install through composer:
php -d memory_limit=-1 composer.phar require atm/pollbundle
In your AppKernel
public function registerbundles()
{
return [
...
...
new ATM\PollBundle\ATMPollBundle(),
];
}
Configuration sample
# app/config/config.yml
atm_poll:
media_folder: path to media folder
Routing
Append to the main routing file:
# app/config/routing.yml
atm_poll:
resource: "@ATMPollBundle/Controller/PollController.php"
type: annotation
prefix: /members
Services
There is only 1 service that search votes and retrieve the items in a poll sorted by it's votes. These are the functions:
public function search($options){
$defaultOptions = array(
'poll_id' => null,
'user_id' => null,
'item_id' => null,
'creation_date' => null,
'ids' => null,
'sorting_field' => null,
'date_limit' => array(
'min' => null,
'max' => null
),
'limit' => null,
'hydrate' => true,
'page' => 1,
'max_results' => null,
'pagination' => null,
'count' => null
);
}
If count is true it will return an array with the following structure:
array(
'count' => $totalVotes
);
public function getItemsByVotes($pollId){}
Show a poll
You can show the poll in you site by using the following call in you twig template:
{{ render(controller('ATMPollBundle:Poll:showPoll',{
'pollId' : pollId
})) }}
You can also use the following route to show the poll in its own page:
{{ path('atm_poll_show',{ 'pollId':pollId }) }}
The view that returns it's in this path:
ATMPollBundle:Poll:show_poll.html.twig
And the variables that are passed to that view are the following:
- poll -> poll object
- items -> items in that poll sorted by number of votes
- totalPollVotes -> total amount of votes of this poll
There is an extra feature to show confetti every time that a user votes successfully, these are the steps to use it:
- Include this script in your page:
<script src="{{ asset('bundles/atmpoll/plugins/confetti/confetti.js') }}"></script>
- Create a <canvas id="canvas"></canvas> somewhere in you page with these styles:
canvas {display: block;position: fixed;z-index: 1;pointer-events: none;top:0;left:0}
- Create these 2 buttons:
<button id="confetti_start" style="display: none"></button>
<button id="confetti_stop" style="display: none"></button>
- Show and hide the confetti with this code:
$('#confetti_start').click();
setTimeout(function(){
$('#confetti_stop').click();
}, 2000);
atm/pollbundle 适用场景与选型建议
atm/pollbundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 140 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 02 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「atm poll bundle」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 atm/pollbundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 atm/pollbundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 atm/pollbundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
2lenet/EasyAdminPlusBundle
The bundle for easy using json-rpc api on your project
Provide a way to secure accesses to all routes of an symfony application.
DMS Meetup API Bundle, enables Meetup API clients in services
Bundle Symfony DaplosBundle
Provides a Data Grid tables for your Symfony project.
统计信息
- 总下载量: 140
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-02-19