ryangjchandler/laravel-feature-flags
A lightweight feature flag package for Laravel. Define features, check whether they are active from your code, and conditionally render UI with Blade directives. A simple API for toggling features and rolling out changes without redeploying.
Architecture fit. ryangjchandler/laravel-feature-flags is a lightweight, self-contained Laravel package: a service provider, a publishable migration and Eloquent model for flag storage, a facade/helper for checks, and (typically) a Blade directive and middleware for gating routes and views. It follows the conventions of the Laravel ecosystem rather than introducing a new runtime, sidecar, or external control plane. That makes it a strong fit for a single Laravel application or a modular monolith where flag state can live in the primary database. It is explicitly opinionated: it is best understood as a persistent boolean toggle registry with light activation semantics, not a targeting or experimentation engine. If the product roadmap includes percentage rollouts, attribute-based targeting, A/B assignment, or per-tenant evaluation at the edge, this package is the wrong tool and will be replaced within a year.
Integration feasibility. Integration cost is low and entirely within our control: composer require, publish config and migrations, run migrations, wrap calls in the facade. There are no API keys, no network hops, no vendor onboarding, no data-processing agreement, and no egress. The main integration work is not adoption but discipline: establishing a naming convention, an internal wrapper interface, a caching strategy, and a lifecycle policy for flag removal. Those are process costs we would incur with any flag system.
Technical risk. The dominant risk is provenance, not code. The package shows zero stars, zero dependents, and no adoption signal, which means we would be one of the only consumers. Realistic implications: bus factor of one, no deprecation policy, no security response process, and a real chance the package is archived or left behind on a future Laravel major. Secondary technical risks: an uncached flag check is a database round trip, so naive use in hot paths (middleware, Blade partials, per-item loops) will add query volume; the opinionated schema may not model the segmentation we eventually want, forcing a fork or migration; and the package almost certainly ships no admin UI, so flag changes become engineering work unless we build one.
Key questions to resolve before commitment.
Stack fit. Appropriate for a Laravel-first backend with a relational database, especially a monolith or a small number of services that can share a database or accept per-service flag tables. Inappropriate for a polyglot or microservice estate where non-PHP services also need flag evaluation — there is no shared evaluation service here, so each language would need its own integration or a homegrown API. In that world, a dedicated platform (Unleash, Flagsmith, LaunchDarkly) is the cheaper long-run choice. Decision rule: one Laravel app, flags are internal release toggles → adopt; multiple runtimes or product-managed targeting → do not.
Migration path. Do not rip out existing config() constants or env-var checks in one pass. Introduce an internal Flags interface (a thin seam with isEnabled(string $flag, $context = null): bool), bind it to the package in a service provider, and migrate call sites feature by feature. This preserves optionality: swapping the package for a commercial provider later becomes one binding change plus a schema/data migration, not a codebase-wide refactor. Backfill existing env-driven toggles into the flags table with a one-time seeder so behavior is identical on cutover.
Compatibility. Verify three things against our actual app before writing code: the package's composer.json constraints against our PHP and Laravel versions; the migration's column types and indexes against our database driver (MySQL vs. Postgres vs. SQLite for test suites); and whether the package registers global middleware or Blade directives that could collide with existing ones. Confirm migrations are publishable so we own schema changes rather than receiving them unexpectedly on composer update.
Sequencing.
Flags interface, naming convention (e.g. domain.feature.intent), and a removal policy (every flag has an owner and an expiry date in the ticket).composer.lock; treat upgrades as reviewed changes, not automatic.Maintenance. The realistic posture is "we own this." With a single maintainer and no dependents, plan for the package to become stagnant. Mitigations: pin the version, keep the internal interface seam, vendor or fork if the maintainer steps away, and budget a small annual cost for a Laravel upgrade cycle. The code surface is small enough that a mid-level Laravel engineer can read the whole package in an afternoon — that is the real insurance policy, and it is good.
Support. Community-only, no SLA, no vendor escalation. We need an internal runbook covering: how to add a flag, how to flip it safely in production, how to confirm propagation, and how to remove one. On-call should know that flag changes are database writes and therefore subject to the same review and rollback discipline as deploys — arguably more so, because they bypass CI.
Scaling. Data volume is trivial: flags are a small table. The scaling concern is read amplification. A default of one query per check is fine at low traffic and quietly expensive at high traffic, especially inside loops or shared Blade partials. Per-request memoization should be non-negotiable; a shared cache with explicit invalidation is the next step. Note the trade-off this creates — caching introduces propagation delay, so a flipped flag may take seconds or minutes to take effect. Decide per flag whether that lag is acceptable; for incident kill-switches it usually is not, and those flags should bypass the cache.
Failure modes to design for explicitly.
Ramp-up. Engineering ramp-up is genuinely cheap — a Laravel developer is productive in under an hour, and the package's conventions are familiar. The real ramp-up cost is organizational: product managers, support, and QA cannot safely flip flags without a UI and a permission model, and the package does not provide one. If non-engineers are expected to participate in release control, budget for a small admin screen plus an access policy, and count that as part of the total cost of adoption rather than a follow-up nice-to-have.
How can I help you explore Laravel packages today?