You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+57-62Lines changed: 57 additions & 62 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,42 +1,46 @@
1
-
# Dynamic feature flags for laravel.
1
+
# Dynamic Feature Flags for Laravel
2
2
3
3
[](https://packagist.org/packages/codinglabsau/laravel-feature-flags)
This package offers the ability to implement feature flags in your application which can be easily toggled on or off. You can also set a feature to a dynamic state where you can define custom rules around whether that feature is enabled or not.
7
+
This package allows instant, zero-deployment toggling of application features.
8
+
9
+
Individual features can be in one of three states:
10
+
- On: enabled for everyone
11
+
- Off: disabled for everyone
12
+
- Dynamic: evaluated according to a custom or default callback
This package caches the state of features to reduce redundant database queries. The cache is expired whenever the feature state changes.
30
35
31
-
### Cache Store
32
-
update your `.env`:
33
-
```php
36
+
By default, this package will use the default cache configured in your application.
37
+
38
+
If you wish to change to a different cache driver, update your `.env`:
39
+
```
34
40
FEATURES_CACHE_STORE=file
35
41
```
36
-
Note that under the hood this package uses the `rememberForever()` method for caching and that if you are using the `Memcached` driver, items that are stored "forever" may be removed when the cache reaches its size limit.
37
42
38
43
### Use Your Own Model
39
-
40
44
To use your own model, update the config and replace the existing reference with your own model:
41
45
42
46
```php
@@ -58,7 +62,6 @@ protected $casts = [
58
62
```
59
63
60
64
## Usage
61
-
62
65
Create a new feature in the database and give it a default state:
63
66
```php
64
67
Feature::create([
@@ -99,47 +102,6 @@ if (FeatureFlag::isEnabled('search-v2')) {
An explicit handler defined using `registerDynamicHandler()` will take precedence over the default handler. If neither a default nor explicit handler has been defined then the feature will resolve to `off` by default.
192
151
193
152
### Handle Missing Features
194
-
195
153
Features must exist in the database otherwise a `MissingFeatureException` will be thrown. This behaviour can be turned off by explicitly handling cases where a feature doesn't exist:
0 commit comments