PHPackages                             minube/featured-flags - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. minube/featured-flags

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

minube/featured-flags
=====================

Featured flag to activate functionality without release new version

017.0kPHP

Since Aug 31Pushed 8y ago8 watchersCompare

[ Source](https://github.com/minube/featured-flags)[ Packagist](https://packagist.org/packages/minube/featured-flags)[ RSS](/packages/minube-featured-flags/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Featured Flags
==============

[](#featured-flags)

[![Build Status](https://camo.githubusercontent.com/4d2bf0712e0b7dd99c3ebbd1de1786dd5472b7bd6780d035a89c971f7d0142f8/68747470733a2f2f7472617669732d63692e6f72672f6d696e7562652f666561747572652d666c61672e706e67)](https://travis-ci.org/minube/feature-flag) [![Code Coverage](https://camo.githubusercontent.com/942b57b36cfa1aa97d1d61228677d0ddffa4c859074014c3b1f47141c3c06cfd/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d696e7562652f66656174757265642d666c6167732f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/minube/featured-flags/?branch=master) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/d2da302abbe0caf2e57b5f52bf78c3c8ccde53eba1b78c19d9df5493ca21d4df/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d696e7562652f66656174757265642d666c6167732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/minube/featured-flags/?branch=master) [![Build Status](https://camo.githubusercontent.com/4d4ea32106438cb617ca460c62f8a9f3ceda0378837c740f6f2088362dbd1492/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d696e7562652f66656174757265642d666c6167732f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/minube/featured-flags/build-status/master)

Featured flag to activate functionality without release new version

How to use it
-------------

[](#how-to-use-it)

###### Database Example (MySQL):

[](#database-example-mysql)

```
CREATE TABLE IF NOT EXISTS `featured_flags` (
  `id` int(10) NOT NULL,
  `name` varchar(100) NOT NULL,
  `status` int(1) DEFAULT 0,
  `start_date` timestamp DEFAULT NULL,
  `end_date` timestamp DEFAULT NULL,
  `params` TEXT DEFAULT NULL,
  `return_params` TEXT DEFAULT NULL,
   PRIMARY KEY (`id`)
);

```

###### Example DB Content

[](#example-db-content)

```
/**
* (id,name,status,start_date,end_date,params,return_params)
* (1,flag1,1,null,null,null,{"data1":"data1_id1","data2":"data2_id1"})
* (2,flag1,1,null,null,{"type":"typeA"},{"data1":"value1","data2":"value2"})
* (3,flag1,1,null,null,{"type":"typeB"},{"data1":"with out color"})
* (4,flag1,1,null,null,{"type":"typeB","color":"Red"},{"data1":"with color"})
* (5,flagDisabled,0,null,null,null,{"data1":"name flagDisabled"})
* (6,flagJanuary,1,2016-01-01 00:00:00,2016-01-31 23:59:59,null,null)
* (7,flagSinceJanuary,1,2016-01-01 00:00:00,null,null,null)
* (8,flagUntilFebruary,1,null,2016-01-31 23:59:59,null,null,null)
*/
```

\######Initialize

```
$pdo = new PDO();
$redis = new Redis();
$featuredFlags = \FeaturedFlags\FeaturedFlagsImpl::getInstance($pdo, $redis);
$flagName = 'flag1';
$filterValuesTypeA = array('type' => 'typeA');
$filterValuesTypeBAndColorRed = array('type' => 'typeB', 'color' => 'red');
```

###### Flag enabled without filter parameters

[](#flag-enabled-without-filter-parameters)

```
if($featuredFlags->isEnabled($flagName))
{
    echo("flag1 is enabled (id:1)");
}
// flag1 is enabled (id:1)
```

###### Flag disabled without filter parameters

[](#flag-disabled-without-filter-parameters)

```
if($featuredFlags->isEnabled('flagDisabled'))
{
    echo("no here");
} else {
    echo("flagDisabled is disabled (id:5)");
}
// flagDisabled is disabled (id:5)
```

###### Flag enabled with one filter parameter

[](#flag-enabled-with-one-filter-parameter)

```
if($featuredFlags->isEnabled($flagName, $filterValuesTypeA))
{
    echo('flag1 with params = {"type":"typeA"} is enabled (id:2)');
}
// flag1 with params = {"type":"typeA"} is enabled (id:2)
```

###### Flag enabled with multiple filter parameters

[](#flag-enabled-with-multiple-filter-parameters)

```
if($featuredFlags->isEnabled($flagName, $filterValuesTypeBAndColorRed))
{
    echo('flag1 with params = {"type":"typeB","color":"Red"} is enabled (id:4)');
}
// flag1 with params = {"type":"typeB","color":"Red"} is enabled (id:4)
```

###### Flag enabled by Date

[](#flag-enabled-by-date)

```
// today = '2016-01-15 00:00:00'
if($featuredFlags->isEnabled('flagJanuary', $filterValuesTypeBAndColorRed))
{
    echo('flagJanuary is enabled only in January 2016');
}
// flagJanuary is enabled only in January 2016
```

###### Flag enabled by StartDate

[](#flag-enabled-by-startdate)

```
// today = '2016-05-15 00:00:00'
if($featuredFlags->isEnabled('flagSinceJanuary', $filterValuesTypeBAndColorRed))
{
    echo('flagSinceJanuary is enabled after January 2016');
}
// flagSinceJanuary is enabled after January 2016
```

###### Flag enabled by EndDate

[](#flag-enabled-by-enddate)

```
// today = '2016-02-15 00:00:00'
if($featuredFlags->isEnabled('flagUntilFebruary', $filterValuesTypeBAndColorRed))
{
    echo('no here');
} else {
    echo('flagUntilFebruary is disabled after February 2016');
}
// flagUntilFebruary is disabled after February 2016
```

###### Get Flag values with without filter parameters

[](#get-flag-values-with-without-filter-parameters)

```
$flagValues = $featuredFlags->getEnabledValues($flagName);
echo('This are the flag1(id:1) values: ');
print_r($flagValues);
/**
* This are the flag1(id:1) values:
* array(
*   'data1' => data1_id1,
*   'data2' => data2_id1
* );
*/
```

###### Get Flag values from disabled flag

[](#get-flag-values-from-disabled-flag)

```
$flagValuesDisabled = $featuredFlags->getEnabledValues('flagDisabled');
echo('The flagDisabled values are disabled: ');
print_r($flagValuesDisabled);
/**
* The flagDisabled values are disabled:
* array();
*/
```

###### Get Flag values from disabled flag with one filter parameter

[](#get-flag-values-from-disabled-flag-with-one-filter-parameter)

```
$flagValuesTypeA = $featuredFlags->getEnabledValues($flagName, $filterValuesTypeA);
echo('This are the flag1(id:2) with params = {"type":"typeA"} values: ');
print_r($flagValuesTypeA);
/**
* This are the flag1(id:2) with params = {"type":"typeA"} values:
* array(
*   'data1' => value1,
*   'data2' => value2
* );
*/
```

###### Get Flag values from disabled flag multiple filter parameters

[](#get-flag-values-from-disabled-flag-multiple-filter-parameters)

```
$flagValuesTypeBRed = $featuredFlags->getEnabledValues($flagName, $filterValuesTypeBAndColorRed);
echo('This are the flag1 with params = {"type":"typeB","color":"Red"} values: ');
print_r($flagValuesTypeBRed);
/**
* 'This are the flag1 with params = {"type":"typeB","color":"Red"} values:
* array(
*   'data1' => with color
* );
*/
```

###  Health Score

25

—

LowBetter than 36% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/bfba603e71625017f8a0426d0754c1a9c26360544bcba19ace3414401e56138f?d=identicon)[fjalvarez](/maintainers/fjalvarez)

![](https://www.gravatar.com/avatar/664e186972153db1a12859aaaf7b247e7226a7ce51aa8d495e61162b4ce0af04?d=identicon)[PedroGarciaGarcia](/maintainers/PedroGarciaGarcia)

---

Top Contributors

[![fjalvarezdd](https://avatars.githubusercontent.com/u/1707308?v=4)](https://github.com/fjalvarezdd "fjalvarezdd (4 commits)")[![PedroGarciaGarcia](https://avatars.githubusercontent.com/u/9948141?v=4)](https://github.com/PedroGarciaGarcia "PedroGarciaGarcia (4 commits)")

### Embed Badge

![Health badge](/badges/minube-featured-flags/health.svg)

```
[![Health](https://phpackages.com/badges/minube-featured-flags/health.svg)](https://phpackages.com/packages/minube-featured-flags)
```

###  Alternatives

[armincms/many-to-many

A Laravel Nova field.

2576.9k3](/packages/armincms-many-to-many)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
