Download the PHP package evanperreau/laravel-feature-flags-lite without Composer
On this page you can find all versions of the php package evanperreau/laravel-feature-flags-lite. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download evanperreau/laravel-feature-flags-lite
More information about evanperreau/laravel-feature-flags-lite
Files in evanperreau/laravel-feature-flags-lite
Package laravel-feature-flags-lite
Short Description A lightweight and simple solution to manage feature flags in your Laravel applications
License MIT
Informations about the package laravel-feature-flags-lite
Laravel Feature Flags Lite
A lightweight and simple solution to manage feature flags in your Laravel applications.
📋 Table of Contents
- Installation
- Configuration
- Usage
- Best Practices
- Contributing
- License
🚀 Installation
You can install the package via composer:
⚙️ Configuration
After installation, publish the configuration file:
This will create a features.php file in your config folder with the following structure:
🔧 Usage
Configuring feature flags
Add your feature flags in the config/features.php configuration file:
Checking if a feature flag is enabled
You can check if a feature flag is enabled in three different ways:
1. Using the facade
2. Using the helper function
3. Using dependency injection
Using in Blade views
You can easily use feature flags in your Blade views:
Using the middleware
You can protect routes or groups of routes with the feature flag middleware. If the feature flag is disabled, the request will be aborted with a 404 response by default.
Protecting a single route
Protecting a route with custom status code
Protecting a group of routes
📝 Best Practices
Naming feature flags
Use descriptive names for your feature flags. For example:
new_user_onboardingpremium_dashboardbeta_reporting_tools
Environment management
You can use different values for your feature flags depending on the environment by using environment variables in your .env file:
And in your features.php configuration file:
👥 Contributing
Contributions are welcome! Feel free to open an issue or submit a pull request.
📄 License
This package is open-source and available under the MIT license.