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 Flags Laravel Package

ylsideas/feature-flags

An extendable Laravel package for managing feature flags in code, routes, Blade views, task scheduling, and validations—making continuous integration and deployment easier by safely guarding features behind toggles.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit

  • Laravel-native package: service provider, Features facade, config publish, and first-class integrations with routing middleware, Blade directives, task scheduling, validation rules, and Eloquent query builder mixins.
  • v2+ architecture uses a pipeline/gateway model (DB, Redis, config, in-memory, chain, Gate) rather than simple repositories, which supports layered flag resolution but adds conceptual overhead for basic use cases.
  • Strong fit for Laravel monoliths and modular monoliths that need code-level toggles without standing up a separate flag service. Weaker fit for polyglot estates or teams needing a vendor-hosted flag UI, percentage rollouts, or sophisticated targeting out of the box.
  • No built-in admin UI; the author markets Flagfox, a commercial dashboard, as the management layer. That creates an architectural dependency decision: adopt the package as a library and build internal tooling, or plan for a commercial companion.

Integration feasibility

  • Low initial effort: composer require ylsideas/feature-flags:^3.0, publish features.php, choose a gateway, and start calling Features::accessible('flag').
  • Existing Laravel conventions are reused (Gate driver, cache stores, middleware registration), so a Laravel team can instrument flags quickly.
  • Migration from env vars, config constants, or ad hoc if statements is straightforward because checks are centralized behind the facade.

Technical risk

  • Bus factor and ecosystem validation: effectively a single-maintainer package with 0 listed dependents in the supplied data. GitHub activity and Laravel-version releases are good signals, but they do not replace multi-maintainer governance or broad production adoption.
  • Commercial alignment risk: the maintainer is building a paid dashboard on top of the package. That is not disqualifying, but it introduces roadmap uncertainty if library and commercial incentives diverge.
  • Abstraction complexity: the pipeline/gateway/chain model is powerful but easy to misconfigure. Chained gateways, per-gateway caches, and fallback semantics need deliberate design and testing.
  • Limited targeting primitives: no native percentage rollout or user-segment targeting. Teams can approximate user targeting through the Gate driver or custom gateways, but that is custom logic we would own.
  • No built-in audit trail or flag lifecycle enforcement. The package provides expiry handlers and debugging, but governance remains our responsibility.
  • Failure semantics are policy decisions, not package defaults. For route middleware especially, we must decide whether an unavailable gateway fails open, fails closed, or errors.

Key questions

  • Do we need per-user, percentage-based, or tenant-scoped rollouts in the next 6–12 months? If yes, is the Gate driver sufficient or do we need a different platform?
  • Which gateway is the source of truth in each environment: config, in-memory, database, or Redis? What is the fallback chain?
  • Who owns the admin interface, and are we willing to build internal tooling or buy Flagfox?
  • What is our fail-open/fail-closed policy for flag evaluation errors, especially on route middleware and authorization paths?
  • What is the exit strategy if the maintainer stops releasing Laravel compatibility updates?
  • How will we prevent flag sprawl, stale toggles, and accidental production enablement?

Integration Approach

Stack fit

  • Compatible with modern Laravel and PHP: v3.1.0 explicitly adds Laravel 13 support, and the release history shows rapid Laravel 10, 11, 12, and 13 alignment. CI covers PHP 8.4 and static analysis.
  • Works with common Laravel infrastructure: Eloquent, Redis, cache stores, Blade, scheduler, and validation. No separate runtime or sidecar required.
  • Best fit where flags are evaluated inside Laravel request/command lifecycles. Not a fit for edge/CDN-level toggles or non-PHP services without additional integration work.

Migration path

  • Start in config or in-memory gateway mode to mirror existing environment-variable behavior with minimal operational change.
  • Replace existing conditional checks incrementally with Features::accessible() and the provided middleware/Blade/validation integrations, starting with low-risk, read-only surfaces.
  • Move the source of truth to database or Redis only after flag semantics and failure policies are agreed.
  • Use the facade’s fake/testing support to stabilize test suites before broad rollout.
  • Avoid jumping major versions mid-migration; v3 is the target, and the v1→v2 upgrade guide exists but v2→v3 is described as low-effort. Pin to ^3.0 and validate against our Laravel version.

Compatibility

  • Confirm Laravel and PHP versions against the package’s compatibility badge and CI matrix before committing.
  • Verify the chosen cache store and Redis/DB drivers behave consistently across all app instances; flags must resolve identically on every node.
  • Check whether our deployment topology uses config caching, queue workers, and scheduled tasks—each has different flag-evaluation timing and cache behavior.
  • If we use the Gate driver for user targeting, validate that authorization logic and flag evaluation do not create circular dependencies.

Sequencing

  1. Spike/PoC: install in a non-production Laravel app, configure in-memory and database gateways, and test middleware, Blade, scheduler, and validation integrations.
  2. Decision gate: confirm gateway topology, fail-open/fail-closed policy, admin ownership, and whether Flagfox or internal tooling is required.
  3. Foundation: publish config, define naming conventions, set up shared cache/store, and establish flag ownership and expiry metadata.
  4. Low-risk instrumentation: wrap read-only or cosmetic features first; add tests using the facade fake.
  5. Operational integrations: add route middleware, scheduled-task guards, and validation rules where appropriate.
  6. Higher-risk migration: move release-critical toggles only after observability and rollback procedures are proven.
  7. Governance: introduce flag lifecycle reviews, stale-flag cleanup, and a documented emergency disable procedure.

Operational Impact

Maintenance

  • Package maintenance appears active: regular releases, changelog discipline, CI, PHPStan, Pint, and codecov. MIT license limits licensing friction.
  • However, maintenance is concentrated in one primary maintainer. We should budget for periodic compatibility validation ourselves and avoid deep coupling to internal package APIs.
  • The pipeline/gateway configuration is a long-lived operational artifact. Changing gateways or chain order later is a migration, not a config tweak.

Support

  • Community support via GitHub issues and the external docs site. No commercial SLA unless we adopt Flagfox or engage the maintainer.
  • Internal runbooks are required for flag creation, approval, rollout, rollback, and deletion. The package supplies mechanisms, not process.
  • The feature:state console command and the v2.1 debugging system are useful first-line diagnostics; we should document them for on-call.

Scaling

  • Evaluation cost depends heavily on gateway choice. Config/in-memory is effectively free; database and Redis add I/O unless cached. Chained gateways multiply lookups.
  • Per-gateway caching helps, but stale-cache windows mean flag flips are not instantaneous. We must define acceptable propagation delay per flag class.
  • Shared Redis or database state is required for consistent behavior across horizontally scaled app instances, queue workers, and scheduled tasks.
  • High-cardinality user targeting should not be pushed into naive database lookups on every request; use cache or Gate-based evaluation carefully.

Failure modes

  • Gateway unavailable: behavior depends on our configuration. Without an explicit policy, route middleware could error or deny unexpectedly. We must codify fail-open vs. fail-closed per integration point.
  • Stale cache: a flag change may not take effect uniformly across nodes, complicating incident response and rollback.
  • Misconfigured chain: an earlier gateway can mask a later one, producing surprising flag state.
  • Flag drift: orphaned flags accumulate, increasing cognitive load and risk. Expiry handlers help but require ownership.
  • Accidental enablement: a flag intended for internal testing can expose a feature broadly if naming and environment scoping are weak.
  • Test leakage: fakes must be reset correctly; multiple-fake support exists, but test hygiene is still on us.

Ramp-up

  • Low for Laravel developers: the facade and integrations are idiomatic, and the docs cover the main patterns.
  • Moderate for the team as a whole: the gateway/pipeline model, cache semantics, and failure policies require deliberate onboarding.
  • TPM-level ramp-up includes establishing flag taxonomy (release, experiment, ops, permission), ownership, expiry expectations, and an admin/visibility path.
  • Plan for a short internal enablement session and a written flag policy before broad adoption; otherwise the package lowers the cost of adding flags without controlling flag debt.
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.
mehedimi/laravel-amp-mail
happones/laravel-vue-i18n-generator
jwerd/inertia-table
siberfx/flysystem-wasabi
hollyit/token-replace
ippanelcom/laravel-sdk
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel