a2zwebltd/laravel-feature-voting
Composer 安装命令:
composer require a2zwebltd/laravel-feature-voting
包简介
A portable Laravel engine for feature requests, voting, and status updates — with optional Blade and Livewire UI layers.
README 文档
README
A portable Laravel engine for feature requests, one-vote-per-user voting, and status updates — with optional Blade and Livewire UI layers.
Drop a feature-voting board into any Laravel app. Users submit ideas, vote (one vote per user, toggleable), and comment. Admins update the status (under_review → planned → in_progress → completed or declined) and submitters are emailed when it changes.
Three layers, each opt-in from the one below:
- Engine — models, migrations, service, events, policies, mailables. Always works.
- HTTP + Blade — controllers, routes, Tailwind-styled views. Works in any Laravel + Tailwind app.
- Livewire — reactive vote button, inline commenting, sortable board. Auto-registers only when
livewire/livewireis installed.
Features
- ✅ One-vote-per-user enforced at the database level (unique index).
- ✅ Submission, voting (toggle), commenting — all through a single
FeatureVotingService. - ✅ Industry-standard status workflow:
under_review,planned,in_progress,completed,declined. - ✅ Admin response field on each request + styled admin comment thread.
- ✅ Email the configured admin on every new submission.
- ✅ Email the submitter every time the status changes — the "closed loop" that research shows is the #1 retention driver for feedback tools.
- ✅ Pluggable admin role — the consumer app defines a Gate; no hard-coded
is_admincolumn. - ✅ Events you can listen to:
FeatureRequestCreated,FeatureRequestVoted,FeatureRequestCommented,FeatureRequestStatusChanged. - ✅ Publishable config, migrations, views, and mail templates.
- ✅ Portable: no assumptions about the User model, theme, or UI library.
Requirements
- PHP
^8.2 - Laravel
^12.0 | ^13.0 - Tailwind CSS in the consumer app (if using the shipped Blade views — not required if you build your own UI)
livewire/livewire^3.0 | ^4.0(optional — only for the Livewire layer)
Installation
composer require a2zwebltd/laravel-feature-voting
Publish and migrate:
php artisan vendor:publish --tag=feature-voting-config php artisan vendor:publish --tag=feature-voting-migrations php artisan migrate
Optionally publish the views if you want to restyle them:
php artisan vendor:publish --tag=feature-voting-views
Configuration
config/feature-voting.php:
'admin_email' => env('FEATURE_VOTING_ADMIN_EMAIL'), 'admin_gate' => 'manage-feature-requests', 'routes' => [ 'enabled' => true, 'prefix' => 'feature-requests', 'middleware' => ['web', 'auth'], ], 'views' => [ 'layout' => 'feature-voting::layouts.default', // point at your own layout 'section' => 'content', ], 'livewire' => ['register' => true],
.env:
FEATURE_VOTING_ADMIN_EMAIL=admin@yourcompany.com
Define who is an admin
The package delegates the "is this user an admin?" decision to a Gate the consumer app defines:
// app/Providers/AppServiceProvider.php — boot() use Illuminate\Support\Facades\Gate; use App\Models\User; Gate::define('manage-feature-requests', function (User $user) { return in_array($user->email, ['dawid@a2zweb.co']); // or $user->is_admin, or a role check, etc. });
If no gate is registered, the package falls back to comparing $user->email to config('feature-voting.admin_email'). If neither is set, nobody is an admin (fail-closed).
Point the views at your own layout
The shipped pages extend a layout you control. In your published config/feature-voting.php:
'views' => [ 'layout' => 'layouts.app', // your existing layout 'section' => 'content', // the @yield name inside it ],
Usage
Drop-in: use the shipped pages
After install you get a working board at /feature-requests. Add a link from your app's nav:
<a href="{{ route('feature-voting.index') }}">Feature Requests</a>
Embed Blade components into your own pages
<x-feature-voting::board /> {{-- full board --}} <x-feature-voting::submit-form /> <x-feature-voting::request-card :request="$r" /> <x-feature-voting::vote-button :request="$r" /> <x-feature-voting::status-badge :status="$r->status" /> <x-feature-voting::comments :request="$r" /> <x-feature-voting::admin-panel :request="$r" /> {{-- renders only for admins --}}
Use the Livewire components
<livewire:feature-voting.board /> <livewire:feature-voting.request-show :request="$r" /> <livewire:feature-voting.vote-button :request="$r" />
Call the engine directly
use A2ZWeb\FeatureVoting\Services\FeatureVotingService; use A2ZWeb\FeatureVoting\Enums\FeatureRequestStatus; $service = app(FeatureVotingService::class); $request = $service->submit($user, 'Add Slack export', 'Would love this'); $service->toggleVote($user, $request); $service->comment($user, $request, 'Same here!'); $service->updateStatus($admin, $request, FeatureRequestStatus::Planned, 'Targeting Q3'); $service->isAdmin($user);
Listen for events
use A2ZWeb\FeatureVoting\Events\FeatureRequestCreated; use Illuminate\Support\Facades\Event; Event::listen(FeatureRequestCreated::class, function ($event) { // ping Slack, create a JIRA ticket, etc. });
Data model
feature_requests — id, user_id (nullable), title, slug unique, description, status, votes_count, comments_count, admin_response, admin_responded_at, metadata (json), timestamps, soft deletes.
feature_request_votes — id, feature_request_id, user_id, timestamps. Unique (feature_request_id, user_id).
feature_request_comments — id, feature_request_id, user_id (nullable), body, is_admin_response, timestamps, soft deletes.
Disabling the HTTP layer
If you want to wire your own routes:
// config/feature-voting.php 'routes' => ['enabled' => false, /* ... */],
Then use the service directly and/or mount the Blade components into your own controllers.
Testing
composer install vendor/bin/pest
Security Vulnerabilities
If you discover a security vulnerability, please report it responsibly through private communication with the maintainers.
License
MIT. See LICENSE.
Credits
Developed and maintained by the A2Z WEB crew:
- Dawid Makowski
- Website: https://a2zweb.co/
- GitHub: https://github.com/a2zwebltd/
a2zwebltd/laravel-feature-voting 适用场景与选型建议
a2zwebltd/laravel-feature-voting 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 88 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 04 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「voting」 「feedback」 「feature-requests」 「feature-voting」 「roadmap」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 a2zwebltd/laravel-feature-voting 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 a2zwebltd/laravel-feature-voting 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 a2zwebltd/laravel-feature-voting 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Ratings Plugin for CakePHP.
Symfony2 Bundle for Bootstrap MaxLength.js - An visual feedback indicator for the MaxLength attribute
TYPO3 Feedback Extension - The TYPO3 Feedback Extension is a great tool for gathering feedback from visitors or customers on your website. With the All In One TYPO3 Feedback extension, website admin can easily add feedback forms in various styles to their website, allowing them to collect valuable i
Create voting campaigns
With feedback.js plugin repository and html2canvas with layout Bootstrap 3
User voting module
统计信息
- 总下载量: 88
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 52
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-04-22