laravelplus/feature-requests
Composer 安装命令:
composer require laravelplus/feature-requests
包简介
A comprehensive Laravel feature requests package with voting system, categories, and status management
README 文档
README
A comprehensive Laravel package for managing feature requests with voting, commenting, and categorization capabilities. Built with modern design principles and a beautiful shadcn/ui inspired interface.
✨ Features
- Feature Request Management: Create, edit, and manage feature requests
- Voting System: Users can vote on feature requests
- Comments & Discussions: Threaded comments for each feature request
- Categorization: Organize requests with categories
- Status Tracking: Track request status (pending, in progress, completed, rejected)
- Priority Levels: Set priority levels (low, medium, high)
- User Management: User authentication and authorization
- Modern UI: Beautiful shadcn/ui inspired admin interface
- API Support: Full REST API for all operations
- Search & Filtering: Advanced search and filtering capabilities
- Responsive Design: Mobile-friendly interface
- Soft Deletes: Safe deletion with recovery options
🚀 Installation
Step 1: Install via Composer
composer require laravelplus/feature-requests
Step 2: Publish Configuration
php artisan vendor:publish --provider="LaravelPlus\FeatureRequests\Providers\FeatureRequestsServiceProvider"
Step 3: Run Migrations
php artisan migrate
Step 4: Create Default Categories (Optional)
php artisan feature-requests:create-default-categories
📋 Configuration
The package configuration is located in config/feature-requests.php:
return [ 'middleware' => ['web', 'auth'], 'prefix' => 'feature-requests', 'user' => [ 'model' => App\Models\User::class, ], 'default_categories' => [ 'User Interface', 'Performance', 'Security', 'API', 'Mobile', 'Integration', ], ];
🎯 Usage
Basic Usage
Creating a Feature Request
use LaravelPlus\FeatureRequests\Models\FeatureRequest; $featureRequest = FeatureRequest::create([ 'title' => 'Dark Mode Support', 'description' => 'Add dark mode theme to the application', 'category_id' => 1, 'priority' => 'medium', 'user_id' => auth()->id(), 'is_public' => true, ]);
Voting on Feature Requests
use LaravelPlus\FeatureRequests\Models\Vote; $vote = Vote::create([ 'user_id' => auth()->id(), 'feature_request_id' => $featureRequest->id, 'vote_type' => 'up', ]);
Adding Comments
use LaravelPlus\FeatureRequests\Models\Comment; $comment = Comment::create([ 'user_id' => auth()->id(), 'feature_request_id' => $featureRequest->id, 'content' => 'This would be a great addition!', ]);
Web Routes
The package provides the following web routes:
// Feature Requests GET /feature-requests // Index GET /feature-requests/create // Create form POST /feature-requests // Store GET /feature-requests/{slug} // Show GET /feature-requests/{slug}/edit // Edit form PUT /feature-requests/{slug} // Update DELETE /feature-requests/{slug} // Destroy // Voting POST /feature-requests/{slug}/vote // Vote DELETE /feature-requests/{slug}/vote // Unvote // Comments POST /feature-requests/{slug}/comments // Store comment PUT /feature-requests/comments/{comment} // Update comment DELETE /feature-requests/comments/{comment} // Delete comment // Categories GET /feature-requests/categories // Index GET /feature-requests/categories/create // Create form POST /feature-requests/categories // Store GET /feature-requests/categories/{slug} // Show GET /feature-requests/categories/{slug}/edit // Edit form PUT /feature-requests/categories/{slug} // Update DELETE /feature-requests/categories/{slug} // Destroy
API Routes
The package also provides comprehensive API routes:
// Feature Requests API GET /api/feature-requests // List all POST /api/feature-requests // Create GET /api/feature-requests/{slug} // Show PUT /api/feature-requests/{slug} // Update DELETE /api/feature-requests/{slug} // Delete PATCH /api/feature-requests/{slug}/status // Update status PATCH /api/feature-requests/{slug}/assign // Assign to user PATCH /api/feature-requests/{slug}/toggle-featured // Toggle featured // Voting API POST /api/feature-requests/{slug}/vote // Vote DELETE /api/feature-requests/{slug}/vote // Unvote GET /api/feature-requests/votes/statistics // Vote statistics // Comments API GET /api/feature-requests/comments // List comments POST /api/feature-requests/comments // Create comment PUT /api/feature-requests/comments/{id} // Update comment DELETE /api/feature-requests/comments/{id} // Delete comment // Categories API GET /api/feature-requests/categories // List categories POST /api/feature-requests/categories // Create category PUT /api/feature-requests/categories/{slug} // Update category DELETE /api/feature-requests/categories/{slug} // Delete category
🎨 Frontend Integration
Vue.js Components
The package includes Vue.js components for easy frontend integration:
<template> <FeatureRequestsIndex /> </template> <script> import FeatureRequestsIndex from '@laravelplus/feature-requests/components/FeatureRequestsIndex.vue' export default { components: { FeatureRequestsIndex } } </script>
Blade Views
Use the included Blade views with your existing Laravel application:
@extends('feature-requests::layouts.app') @section('content') <div class="container"> <h1>Feature Requests</h1> <!-- Your content here --> </div> @endsection
🔧 Models
FeatureRequest Model
use LaravelPlus\FeatureRequests\Models\FeatureRequest; // Scopes $featureRequests = FeatureRequest::published()->get(); $featureRequests = FeatureRequest::featured()->get(); $featureRequests = FeatureRequest::byStatus('pending')->get(); $featureRequests = FeatureRequest::byPriority('high')->get(); $featureRequests = FeatureRequest::byCategory($categoryId)->get(); $featureRequests = FeatureRequest::mostVoted()->get(); $featureRequests = FeatureRequest::recent()->get(); // Relationships $featureRequest->user; // BelongsTo User $featureRequest->category; // BelongsTo Category $featureRequest->votes; // HasMany Vote $featureRequest->comments; // HasMany Comment
Category Model
use LaravelPlus\FeatureRequests\Models\Category; // Scopes $categories = Category::active()->get(); $categories = Category::bySlug('user-interface')->get(); $categories = Category::withFeatureRequests()->get(); // Relationships $category->featureRequests; // HasMany FeatureRequest
Vote Model
use LaravelPlus\FeatureRequests\Models\Vote; // Scopes $votes = Vote::byType('up')->get(); $votes = Vote::byUser($userId)->get(); $votes = Vote::byFeatureRequest($featureRequestId)->get(); $votes = Vote::upVotes()->get(); $votes = Vote::downVotes()->get(); // Relationships $vote->user; // BelongsTo User $vote->featureRequest; // BelongsTo FeatureRequest
Comment Model
use LaravelPlus\FeatureRequests\Models\Comment; // Scopes $comments = Comment::approved()->get(); $comments = Comment::pinned()->get(); $comments = Comment::byUser($userId)->get(); $comments = Comment::byFeatureRequest($featureRequestId)->get(); $comments = Comment::parentComments()->get(); $comments = Comment::replies()->get(); $comments = Comment::recent()->get(); // Relationships $comment->user; // BelongsTo User $comment->featureRequest; // BelongsTo FeatureRequest $comment->parent; // BelongsTo Comment (parent) $comment->replies; // HasMany Comment (replies)
🧪 Testing
Run the test suite:
# Run all tests ./vendor/bin/phpunit # Run specific test ./vendor/bin/phpunit tests/Unit/Models/FeatureRequestTest.php # Run with coverage ./vendor/bin/phpunit --coverage-html coverage
Test Structure
tests/
├── Unit/
│ ├── Models/
│ │ ├── FeatureRequestTest.php
│ │ ├── CategoryTest.php
│ │ ├── VoteTest.php
│ │ └── CommentTest.php
│ ├── Services/
│ └── Repositories/
├── Feature/
│ ├── FeatureRequestControllerTest.php
│ ├── VoteControllerTest.php
│ ├── CommentControllerTest.php
│ └── CategoryControllerTest.php
└── TestCase.php
🎨 Customization
Custom Views
Publish and customize the views:
php artisan vendor:publish --tag=feature-requests-views
Custom Styling
The package uses Tailwind CSS with shadcn/ui design tokens. You can customize the styling by:
- Publishing the views
- Modifying the CSS classes
- Adding your own custom styles
Custom Middleware
Add custom middleware in the configuration:
'middleware' => ['web', 'auth', 'custom-middleware'],
🔒 Security
- Authentication: All routes require authentication by default
- Authorization: Users can only edit their own feature requests
- Validation: Comprehensive input validation
- CSRF Protection: All forms include CSRF tokens
- XSS Protection: Output is properly escaped
📊 Statistics
The package provides built-in statistics:
use LaravelPlus\FeatureRequests\FeatureRequests; // Get overall statistics $stats = FeatureRequests::getStatistics(); // Get vote statistics $voteStats = FeatureRequests::getVoteStatistics(); // Get category statistics $categoryStats = FeatureRequests::getCategoryStatistics();
🚀 Performance
- Eager Loading: Relationships are properly eager loaded
- Database Indexing: Optimized database indexes
- Caching: Built-in caching for frequently accessed data
- Pagination: Efficient pagination for large datasets
🤝 Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📝 License
This package is open-sourced software licensed under the MIT license.
🆘 Support
- Documentation: GitHub Wiki
- Issues: GitHub Issues
- Discussions: GitHub Discussions
🙏 Acknowledgments
- Built with Laravel
- UI inspired by shadcn/ui
- Icons by Lucide
- Styling with Tailwind CSS
Made with ❤️ by the LaravelPlus team
laravelplus/feature-requests 适用场景与选型建议
laravelplus/feature-requests 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 72 次下载、GitHub Stars 达 3, 最近一次更新时间为 2025 年 09 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「voting」 「feedback」 「product-management」 「feature-requests」 「user-requests」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 laravelplus/feature-requests 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 laravelplus/feature-requests 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 laravelplus/feature-requests 相关的其它包
同方向 / 同关键字的高下载量 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
统计信息
- 总下载量: 72
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 31
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-09-10