- How do I install and set up antfroger/progressive in Laravel?
- Install it with composer require antfroger/progressive. Then create a config array or load a PHP/YAML file and instantiate Progressive, or bind it in a Laravel service provider. You can place flags in config/progressive.php and resolve the Progressive instance through the container.
- Which Laravel and PHP versions does Progressive support?
- Progressive requires PHP 8.1 or newer and works out of the box with Laravel 9 and later. It is not tightly coupled to Laravel and can also run in any PHP 8.1+ project. Older Laravel versions may need minor adjustments.
- How do I define feature flags in Progressive?
- Provide a configuration array with a features key, or parse a YAML file into the same structure. Each flag can be a simple boolean such as dark-theme true or an array with enabled true. Progressive evaluates those definitions when you instantiate the library.
- Can I use Progressive outside of Laravel?
- Yes, Progressive is a standalone PHP library that does not require Laravel. It only needs PHP 8.1 or newer and can be instantiated directly in vanilla PHP applications. You lose Laravel container and config conveniences, but the core flag evaluation works the same way.
- How do I implement gradual rollouts or environment-based flags with Progressive?
- Use custom rules through addCustomRule and pass a closure that receives a Context object. For example, define an env rule that checks getenv('ENV') against DEV or PREPROD and reference that rule in the flag config. You can write additional rules for user segments or percentage rollouts by returning booleans from your closures.
- How do I test feature flags with Progressive in PHPUnit?
- Instantiate Progressive with test-specific configuration so each flag returns a deterministic value. In unit tests, build a config array with the flags enabled or disabled for the scenario and assert the resulting behavior. You can also wrap flag checks behind an interface and inject a stub or mocked Progressive instance.
- Does Progressive store flags in a database?
- The core library is config-driven and does not include built-in database persistence. In Laravel you can optionally persist flags with Eloquent models and load them into the Progressive config. If you do that, version-control your migrations and handle live reload or caching yourself.
- Is Progressive a good alternative to LaunchDarkly or spatie/laravel-feature-flags?
- Progressive is a lightweight alternative for teams that want simple PHP-native flags without external infrastructure. It has a simpler API and works in vanilla PHP as well as Laravel. It does not provide a UI, audit logs, built-in caching, or advanced targeting, so evaluate those gaps against your production needs.
- How do I handle sensitive or admin-only feature flags in Progressive?
- Flags are not encrypted by default, so do not store secrets in flag payloads. Keep sensitive toggles in environment variables or another secure config source and gate flag management behind Laravel authorization. Treat flag names and conditions as application code and review changes carefully.
- What are the production concerns when using Progressive at scale?
- There is no built-in caching, so high-traffic or multi-region apps should cache resolved config or flag values with Redis or Memcached. Flag evaluation is PHP-native and low overhead, but loading flags from a database on every request can add latency. Also define fallback behavior and add audit logging if compliance requires it.