gramzivi/flag-it-bundle
FlagItBundle adds a flexible flagging and moderation system to Symfony applications. Users can report content or entities, define configurable flag types, and help teams review and manage flagged items through a simple, integration-friendly workflow.
composer show symfony/* before installing to avoid dependency conflicts.php artisan vendor:publish --tag=feature-flags-config). The file to inspect first is the feature flag config containing clients and defaults.clientsdefaultsClientContextInterface in a service provider. The provided DefaultClientContext reads the current client from an environment variable or a container parameter. For multi-tenant apps, replace it with your own context implementation.FeatureFlagManager into a controller or service and check a flag:
if ($this->featureFlags->isEnabled('new-checkout')) {
// new flow
}
Start with a single flag in defaults, override it for one client, and verify the fallback behavior.Multi-client configuration. Structure config around defaults for safe fallbacks and clients for targeted rollouts:
return [
'defaults' => [
'new-checkout' => false,
],
'clients' => [
'acme' => [
'new-checkout' => true,
],
],
];
Use global flags for application-wide defaults and per-client entries only where behavior must differ.
Context-based resolution. Implement ClientContextInterface to resolve the client from the current request, authenticated tenant, subdomain, or header. Bind it early in the request lifecycle so the manager has a stable client before any flag checks.
Per-request middleware. If the client varies per request, set or refresh the context in middleware. Avoid resolving the client in a singleton that is constructed before the request is available.
Fallback-aware checks. Rely on the manager’s global → per-client → default resolution rather than duplicating fallback logic in application code. This keeps rollout rules in one place.
Testing. Swap the ClientContextInterface binding with a test implementation that returns a known client. This is more reliable than mutating environment variables or container parameters between tests.
Service overrides. The release fixes autowiring for array arguments by defining parameters explicitly. If you decorate or replace FeatureFlagManager, pass the clients and defaults arrays explicitly in your service definition.
Extension point. Decorate FeatureFlagManager or ClientContextInterface to add logging, metrics, or audit trails around flag resolution without changing the package internals.
1.0.0-beta release. Pin the exact version in composer.json and review changelogs before upgrading.DefaultClientContext reads from an environment variable or parameter. Confirm the exact variable/parameter name in the package config and set it consistently across local, staging, and production.clients and defaults array arguments.How can I help you explore Laravel packages today?