Download the PHP package amirhf1/feature-toggle without Composer
On this page you can find all versions of the php package amirhf1/feature-toggle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download amirhf1/feature-toggle
More information about amirhf1/feature-toggle
Files in amirhf1/feature-toggle
Package feature-toggle
Short Description FeatureFlip is a dynamic Laravel package that simplifies the management of feature toggles, allowing developers to switch functionalities on or off with ease. Enhance your application's flexibility and reduce deployment risks by controlling feature availability without altering the codebase.
License MIT
Informations about the package feature-toggle
FeatureToggle
FeatureToggle is a Laravel package that provides a simple and flexible way to manage feature flags within your application. Enable or disable features on the fly without deploying new code, enhancing your application's flexibility and allowing for better control over feature releases.
Table of Contents
- Features
- Installation
- Configuration
- Usage
- Checking Feature Status
- Enabling/Disabling Features
- Middleware
- Blade Directives
- Database Setup
- Contributing
- License
Features
- Easy Integration: Seamlessly integrates with Laravel applications.
- Database-Driven: Store feature flags in the database for dynamic control.
- Facade & Helper Functions: Access feature toggles effortlessly throughout your application.
- Middleware Support: Protect routes based on feature flags.
- Blade Directives: Conditionally display content in Blade templates.
- Extensible: Easily extendable to fit your application's needs.
Installation
You can install the package via Composer:
Configuration
After installation, publish the configuration and migration files:
Then, run the migrations to create the features
table:
Note: For Laravel versions >=5.5, the package uses Package Auto-Discovery, so manual registration of the service provider and facade is not required. For older versions, refer to the Installation section.
Usage
Checking Feature Status
Use the FeatureToggle
facade to check if a feature is enabled:
Enabling/Disabling Features
Enable or disable features programmatically:
Middleware
Protect your routes based on feature flags by using the provided middleware.
-
Register Middleware:
The middleware is automatically registered by the package. If not, ensure it's registered in your
FeatureToggleServiceProvider
. -
Apply Middleware to Routes:
If the feature is disabled, accessing
/new-dashboard
will result in a 404 error or a custom response as defined.
Blade Directives
Conditionally display content in your Blade templates using the @feature
directive.
Database Setup
The package uses a features
table to store feature flags. After publishing and running the migrations, you can manage features via Eloquent models or directly through the database.
Seeding Default Features
Optionally, you can create a seeder to populate default features:
Run the seeder:
Contributing
Contributions are welcome! Please follow these steps to contribute:
- Fork the Repository
-
Create a Feature Branch
-
Commit Your Changes
-
Push to the Branch
- Open a Pull Request
Please ensure your code adheres to the project's coding standards and includes appropriate tests.
License
The MIT License (MIT). Please see LICENSE for more information.