定制 beqqaa/laravel-feature-flags 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-04-07