Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Feature Flag Bundle

Feature Flag Bundle Laravel Package

em411/feature-flag-bundle

A Symfony bundle for feature flags: enable or disable code paths based on context-aware callables. This is a Symfony 4.4 / PHP 7.4 backport of ajgarlag/feature-flag-bundle, keeping the same API and namespace for a drop-in upgrade from the upstream package.

View on GitHub
Deep Wiki
Context7

Provides a feature flag mechanism for Symfony Appllications

Frequently asked questions about Feature Flag Bundle
Does em411/feature-flag-bundle support Laravel?
No. It is a Symfony bundle backported for Symfony 4.4 and PHP 7.4, and it registers as Ajgarlag\FeatureFlagBundle\FeatureFlagBundle in a Symfony kernel. Laravel applications should use Laravel Pennant or a Laravel-specific feature flag package instead. The Composer package name is em411/feature-flag-bundle, but the PHP namespace intentionally remains Ajgarlag\FeatureFlagBundle\.
How do I install em411/feature-flag-bundle in a Symfony 4.4 app?
Run composer require em411/feature-flag-bundle. Symfony Flex usually registers Ajgarlag\FeatureFlagBundle\FeatureFlagBundle automatically; otherwise add it to config/bundles.php with ['all' => true]. No migrations, queue workers, or outbound network calls are required unless a provider adds them.
How do I define a feature flag with a callable in Symfony?
Declare a callable that returns the value to compare, then expose it with the @AsFeature annotation or the ajgarlag.feature_flag.feature service tag. The checker compares the callable result to the expected value, usually a boolean, and feature_is_enabled() returns the match. You can also use the FeatureCheckerInterface service directly in controllers or services.
What is the difference between em411/feature-flag-bundle and ajgarlag/feature-flag-bundle?
This package is a backport of ajgarlag/feature-flag-bundle for Symfony 4.4 and PHP 7.4, keeping the same API and Ajgarlag\FeatureFlagBundle\ namespace for drop-in compatibility. Use upstream ajgarlag/feature-flag-bundle if you run Symfony 6+ and PHP 8.1+ with native attributes. Use this fork only when the legacy stack prevents upgrading.
Why is the Composer package em411/feature-flag-bundle but the namespace Ajgarlag\FeatureFlagBundle?
The namespace is kept identical to the upstream package so existing imports, bundle registration, and annotations work unchanged after swapping the Composer requirement. That is deliberate for a drop-in upgrade from ajgarlag/feature-flag-bundle. It can still confuse code review, SBOM generation, and incident response, so document which package owns the class.
Do I need doctrine/annotations to use @AsFeature on PHP 7.4?
Yes, the @AsFeature annotation requires the doctrine/annotations runtime, and this fork cannot use native PHP 8 attributes on PHP 7.4. Teams must keep doctrine/annotations installed and accept that annotation syntax is onboarding friction for engineers used to attributes. If you want to avoid the dependency, register features through the ajgarlag.feature_flag.feature service tag instead.
How do Twig and the Symfony profiler integrate with this feature flag bundle?
The Twig bridge and profiler collector are available automatically when Twig and WebProfiler are present. You get Twig functions for checking flags and a profiler panel that helps inspect flag evaluation during development. No extra configuration is required for the basic integration.
Can I gate Symfony routes with feature flags?
Not directly through route condition expressions in Symfony 4.4, because route conditions cannot evaluate services. Gate routes in controllers or implement a kernel.controller listener that checks FeatureCheckerInterface before the controller runs. For a large routing surface, plan that listener abstraction before rollout so gating logic stays auditable.
How should I test feature flags in a Symfony application?
Override FeatureCheckerInterface or the provider in the test container, or use the in-memory provider to return deterministic values per test. Then assert that enabled and disabled code paths behave correctly without a database or queue. The narrow service-provider design keeps tests fast and avoids network calls.
What are the production risks of adopting em411/feature-flag-bundle?
The package targets Symfony 4.4 and PHP 7.4, both end-of-life, and its CI sets config.audit.block-insecure: false because Composer's audit blocks pinned dependencies. It is a single-maintainer fork with zero stars and no external dependents, so there is no community bug-catching or support SLO. The changelog is semver-disciplined and professional, but treat the package as a tactical backport, not a strategic platform choice.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo
bernskioldmedia/laravel-harvest
bernskiold/laravel-data-scrubber
bernskiold/laravel-currency-converter
bernskiold/laravel-campaign-monitor
bernskioldmedia/laravel-autotranslate
siberfx/telegram-bot
roy-sandip/laravel-view-extended
gregsphotography/site-builder-core
roy-sandip/laravel-view
anodyne/blade-fluentui-icons
webx-ui/module-catalog-collections