PHPackages                             antonkuku/featureflag - 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. antonkuku/featureflag

ActiveLibrary

antonkuku/featureflag
=====================

A library for easy work with feature flags

1.0.0(5y ago)06MITPHPPHP &gt;=7CI failing

Since Jul 11Pushed 5y ago1 watchersCompare

[ Source](https://github.com/antonkuku/featureflag)[ Packagist](https://packagist.org/packages/antonkuku/featureflag)[ Docs](https://github.com/antonkuku/featureflag)[ RSS](/packages/antonkuku-featureflag/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

### Feature flag

[](#feature-flag)

Library for easy work with feature flags in PHP.

The library allows to add multiple data sources (in case you want to have config with default values and another configs with overridden values).

#### Data sources

[](#data-sources)

Just for example I've some sources:

- SimpleArray
- SimpleArrayWritable - an example for writable data sources
- SimpleObject
- RemoteJsonCurl

To add another data source you need to create a new class and implement \\FeatureFlag\\Contracts\\DataSourceInterface with 3 methods:

- exists - to know that selected flag exists
- get - to get flag value
- all - to return available flags from data source

In case you need to add/update/delete flags values you can implement \\FeatureFlag\\Contracts\\WritableSourceInterface with 3 methods:

- add
- update
- delete

#### Examples

[](#examples)

Single source

```
// init array of flags with values
$config = ['first_flag' => true, 'second_flag' => false];
// init data source
$ds = new \FeatureFlag\DataSources\SimpleArray($config);
// create instance of service and add data source
$service = new \FeatureFlag\FeatureFlag();
$service->addSource($ds);
// single condition check
if($service->enabled('first_flag')) {
    // do something
}
// multiple flags check
if($service->enabledWithDependencies('first_flag', ['second_flag' => false])) {
    // do something
}

```

Multiple sources

```
// init first data source
$firstDsConfig = ['first_flag' => true, 'second_flag' => false];
$firstDs = new \FeatureFlag\DataSources\SimpleArray($firstDsConfig);
// init second data source
$secondDsConfig = new \stdClass;
$secondDsConfig->first_flag = false;
$secondDs = new \FeatureFlag\DataSources\SimpleObject($secondDsConfig);
// init service
$service = new \FeatureFlag\FeatureFlag([$firstDs, $secondDs]);
//
$service->enabled('second_flag'); // false
$service->enabled('first_flag'); // false

```

#### Installation

[](#installation)

`composer require antonkuku/featureflag`

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2133d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c9d6bfdd3015e1f7c5b49db72ec586cc73fc950d55dbbe404e08a23c1e67c0d7?d=identicon)[Anton Kuku](/maintainers/Anton%20Kuku)

---

Top Contributors

[![antonkuku](https://avatars.githubusercontent.com/u/8190645?v=4)](https://github.com/antonkuku "antonkuku (6 commits)")

---

Tags

phpfeature-flagsfeature flag

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/antonkuku-featureflag/health.svg)

```
[![Health](https://phpackages.com/badges/antonkuku-featureflag/health.svg)](https://phpackages.com/packages/antonkuku-featureflag)
```

###  Alternatives

[theodo-group/llphant

LLPhant is a library to help you build Generative AI applications.

1.5k311.5k5](/packages/theodo-group-llphant)[mozex/anthropic-php

Anthropic PHP is a supercharged community-maintained PHP API client that allows you to interact with Anthropic API.

46365.1k13](/packages/mozex-anthropic-php)

PHPackages © 2026

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