adespresso/feature-bundle
Symfony bundle for feature releases and rollouts. Manage feature flags and enable new functionality for specific subsets of users. Includes API docs, documentation in Resources/doc, tests, and Apache 2.0 license.
ContainerInterface, EventDispatcher).EventDispatcher can be replaced with Laravel’s Events or Service Providers.FeatureMiddleware).config/feature-flags.php or database-backed storage.ParameterBag). Mitigate via abstraction layer.spatie/laravel-feature-flags (more maintained, Laravel-first).ContainerInterface with Laravel’s Illuminate\Contracts\Container\Container.EventDispatcher with Laravel’s Events or Service Providers.FeatureMiddleware to evaluate flags on each request (e.g., app/Http/Middleware/CheckFeatures.php).public function handle($request, Closure $next) {
$feature = Feature::findByName($request->feature);
if (!$feature->isEnabledFor($request->user())) {
abort(403); // or redirect
}
return $next($request);
}
$this->app->singleton(FeatureManager::class, function ($app) {
return new FeatureManager(
$app->make(FeatureRepository::class),
$app->make(ConditionEvaluator::class)
);
});
feature_usage table).Log::debug('Feature evaluated', ['feature' => $name, 'user' => $user->id, 'enabled' => $enabled]);
feature_flags table on name and user_segment.UserSegment to support tenant IDs:
class TenantAwareSegment implements UserSegmentInterface {
public function matches(User $user): bool {
return $user->tenantId === $this->tenantId;
}
}
| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Database downtime | Feature flags unavailable | Fallback to config file cache |
| Middleware error | 500 errors for all requests | Circuit breaker (e.g., Spatie\CircuitBreaker) |
| Cache invalidation race | Stale feature flags | Use Redis with WATCH or database transactions |
| Symfony dependency breakage | Integration fails | Abstract behind interfaces; mock dependencies |
# Enable a feature for 10% of users
php artisan feature:enable analytics --percentage=10
# List all active features for a user
php artisan feature:list --user=1
premium plan").How can I help you explore Laravel packages today?