- How do I install francescomalatesta/laravel-feature?
- Install it with composer require francescomalatesta/laravel-feature, then publish the package config and migration files with the vendor:publish command. Run php artisan migrate to create the features table that stores flag state. Finally, declare your features in the package config file so the package knows which flags exist.
- Does laravel-feature support per-user feature flags?
- Yes, it supports optional per-entity scoping by adding the package trait to any Eloquent model, such as your User or Account model. Once the trait is applied you can check whether a flag is enabled for that specific model instance rather than globally. This covers the common SaaS case of enabling a feature for a subset of users or tenants.
- Does laravel-feature work with Laravel 9, 10, or 11?
- The package is designed around Laravel 5.x-era conventions and its composer constraints on illuminate/* and PHP are likely to block installation on Laravel 9, 10, or 11 without changes. You should run a short compatibility spike before committing to it: install against your target Laravel version, publish and run the migration, and exercise both global and scoped checks. Expect to pin an older Laravel, fork the package with widened constraints, or vendor the source into your application.
- How do I check a feature flag in my Laravel code?
- Laravel Feature exposes a Feature facade and a feature() helper, so you can call Feature::isEnabled('my-flag') or the helper equivalent anywhere in your application. Blade directives are included so you can wrap markup blocks in a conditional without writing PHP. Middleware support lets you gate whole routes behind a flag.
- Is francescomalatesta/laravel-feature still maintained?
- Signals point to it being effectively unmaintained: around 210 GitHub stars and a Laravel 5.x-era design, with no indication of recent releases. That does not make it unusable, but it means you should treat the package as frozen code you own rather than an actively supported dependency. Budget engineering time for a fork or an internal replacement instead of expecting upstream fixes.
- Does laravel-feature add a database query on every flag check?
- Yes, flag state is persisted in a features table and checks read from that store, so every evaluation is a potential query unless you add caching. Per-entity checks inside loops or over collections are the biggest risk and can produce N+1 query patterns. Add per-request memoization plus a short-TTL cache store from day one, and load flag state in bulk when checking many subjects.
- Can I do percentage rollouts or A/B tests with laravel-feature?
- No, the package implements a simple on/off model with optional per-entity scoping and does not provide percentage rollouts, rule-based targeting, or experiment assignment. If you need gradual percentage ramps or audience rules within the next year, this package will not get you there on its own. You would need to layer your own bucketing logic on top or choose a more capable flag system.
- What are good alternatives to laravel-feature for feature flagging in Laravel?
- Laravel Pennant is the first-party option and covers most simple toggle and per-user use cases with active maintenance. For managed, multi-service flagging with targeting rules and audit history, LaunchDarkly, Unleash, and Flagsmith are the usual candidates. The pragmatic middle path is to define your own FeatureFlags interface, bind this package as the first adapter, and swap in Pennant or a managed provider later as a one-class change.
- How do I add a new feature flag with this package?
- You declare the feature in the package config file, which acts as the canonical registry of flag names, and its state is then stored in the features table. Toggling is done by flipping the stored value globally or by scoping it to an entity through the model trait. Because there is no admin UI or change history, establish a naming convention and an owner for each flag up front so they do not accumulate silently.
- Is laravel-feature safe and legal to fork for production use?
- It is MIT licensed, so forking, modifying, and vendoring the source into your application is legally clean and carries no commercial exposure. The cost of abandonment is therefore engineering time rather than legal risk. Keep the package behind an internal interface and cache flag reads, then onboard one low-risk flag such as a dark launch or kill switch to validate the operational loop before widening adoption.