beqqaa/laravel-feature-flags
最新稳定版本:v0.0.2
Composer 安装命令:
composer require beqqaa/laravel-feature-flags
包简介
Simple, extendable and automated feature flag system for Laravel
README 文档
README
A simple, extendable, and automated feature flag system for Laravel.
Supports caching, automatic API routing, and publishable configuration & migrations.
🚀 Features
- ✅ Feature toggling using database
- ✅ Facade and service-based access
- ✅ Publishable migration & config
- ✅ Automatic route registration for REST API
- ✅ Ready for integration with external admin UI
📦 Installation
composer require beqqaa/laravel-feature-flags
If you're using Laravel 8–11, you're good to go.
🔧 Publish Config & Migration
php artisan vendor:publish --tag=feature-flags-config php artisan vendor:publish --tag=feature-flags-migrations php artisan migrate
✅ Usage
Enable a feature
Feature::enable('new_checkout');
Disable a feature
Feature::disable('new_checkout');
Check if a feature is enabled
if (Feature::isEnabled('new_checkout')) { // Show new checkout }
🧠 API Endpoints
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/feature-flags |
Get all feature flags |
| POST | /api/feature-flags |
Create new flag |
| PUT | /api/feature-flags/{key} |
Update flag status |
| DELETE | /api/feature-flags/{key} |
Delete flag |
Endpoint prefix and middleware can be configured.
⚙️ Configuration (config/feature-flags.php)
return [ 'cache_ttl' => 60, // In minutes. Set to 0 to disable caching. 'route_prefix' => 'api/feature-flags', 'middleware' => ['api'], // Add 'auth:sanctum' or others as needed ];
🧩 React Admin UI (Optional)
This package is backend-only.
To manage flags visually, check out the upcoming frontend dashboard (React + Vite) at:
Coming soon: beqqaa/feature-flags-dashboard
🧪 Testing & Development
Coming soon: unit tests and mock support.
🤝 Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss.
📄 License
MIT © beqqaa
统计信息
- 总下载量: 9
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-04-07