laravelplus / feature-requests
A comprehensive Laravel feature requests package with voting system, categories, and status management
Requires
- php: ^8.4
- illuminate/console: ^12.0
- illuminate/database: ^12.0
- illuminate/events: ^12.0
- illuminate/http: ^12.0
- illuminate/support: ^12.0
- laravel/framework: ^12.0
- spatie/laravel-permission: ^6.0
- spatie/laravel-sluggable: ^3.0
Requires (Dev)
- laravel/pint: ^1.24
- mockery/mockery: ^1.6
- orchestra/testbench: ^10.0
- phpunit/phpunit: ^11.0
This package is not auto-updated.
Last update: 2025-09-11 08:40:01 UTC
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