- What is codinglabsau/laravel-feature-flags used for?
- It is a Laravel package for database-backed feature flags. You define flags, enable or disable them globally or for individual users, and check their status in controllers, Blade templates, and middleware. It is intended for Laravel applications that need instant, zero-deployment toggling of application features.
- How do I install laravel-feature-flags in a Laravel application?
- Install it with Composer using composer require codinglabsau/laravel-feature-flags. Then publish the package config and migrations, run the migrations to create the flags table, and optionally register the facade alias. Pin to ^1.6.1 or later so you get the corrected FeatureFlag facade alias.
- Which Laravel and PHP versions does laravel-feature-flags support?
- The package is a Laravel/PHP library and depends on the framework's service provider, facade, Eloquent, and cache conventions. The exact Laravel and PHP version constraints are defined in its composer.json and release documentation. Confirm that matrix against your runtime before adopting it, especially because Laravel's release cadence can leave small packages behind.
- How do I enable or disable a feature globally or for a specific user?
- The package supports global on/off toggles and per-user flag status, so you can roll a feature out to selected users without deploying. You define the flag, set its state, and then query it through the package API. For production use, keep flag checks behind a thin application-level service rather than scattering facade calls throughout the codebase.
- Can I check feature flags in Blade templates, controllers, and middleware?
- Yes. The package is designed to expose flag status checks in controllers, Blade templates, and middleware through a simple, expressive API. That lets you gate routes, conditionally render UI, and branch application logic from the same flag definitions. Wrap those checks in your own service if you want insulation from future package or provider changes.
- Does laravel-feature-flags support percentage rollouts, user segments, or scheduled flags?
- The documented API centers on database-backed global and per-user flag toggles. The context does not establish support for percentage rollouts, user segments, or scheduling, so verify those targeting features before assuming they exist. If you need rich targeting across services, a hosted feature flag service may be a better fit.
- Is laravel-feature-flags suitable for production use?
- It can be suitable for a standard Laravel monolith, but it is a small, single-maintainer package, so bus factor and long-term maintenance are the main risks. Pin versions, validate upgrades in staging, and wrap flag evaluation in an internal service. Also confirm how flag reads perform and what happens if the flag store is unreachable before relying on it in critical paths.
- What was the v1.6.1 facade alias fix in laravel-feature-flags?
- v1.6.1 corrects the FeatureFlag facade alias, which in v1.6.0 pointed at a nonexistent plural class. Teams that followed the documented alias registration would have hit a class-not-found error on first use of the alias. The patch is backward compatible and repairs a broken public surface rather than changing working behavior.
- How should I test laravel-feature-flags in my Laravel application?
- Exercise the facade and your flag checks in integration tests rather than only unit-testing the package internals. The v1.6.0 alias defect shows why a smoke test that resolves the facade is valuable. Test both enabled and disabled states, and run a staging deployment before production rollout.
- When should I use laravel-feature-flags instead of a hosted feature flag service?
- Use it when you have a Laravel monolith or a small number of Laravel services and want low-ceremony, database-backed toggles without an external dependency. Avoid it as your only solution in polyglot estates where flags must evaluate consistently in non-PHP runtimes. In that case, use a remote-evaluation service or add SDKs for the other stacks.