PHPackages                             onix-systems-php/hyperf-feature-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. onix-systems-php/hyperf-feature-flags

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

onix-systems-php/hyperf-feature-flags
=====================================

An extension for feature flags

v1.0.1(2y ago)03PHP

Since Feb 6Pushed 2y ago2 watchersCompare

[ Source](https://github.com/onix-systems-php/hyperf-feature-flags)[ Packagist](https://packagist.org/packages/onix-systems-php/hyperf-feature-flags)[ RSS](/packages/onix-systems-php-hyperf-feature-flags/feed)WikiDiscussions main Synced 1mo ago

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

Hyperf-feature-flags component
==============================

[](#hyperf-feature-flags-component)

Includes the following general usage classes:

- Annotations:
    - FeatureFlag;
- Aspects:
    - FeatureFlagAspect;
- Constants:
    - Actions;
- DTO:
    - ResetFeatureFlagDTO;
    - UpdateFeatureFlagDTO;
- Event:
    - Action;
- Model:
    - FeatureFlag;
- Repository:
    - FeatureFlagRepository;
- Service:
    - GetCurrentFeatureFlagService;
    - GetFeatureFlagService;
    - GetOverriddenFeatureFlagService;
    - ResetFeatureFlagService;
    - SetFeatureFlagService
- Other:
    - RedisWrapper

Installation:
-------------

[](#installation)

```
composer require onix-systems-php/hyperf-feature-flags
```

Publishing the config:
----------------------

[](#publishing-the-config)

```
php bin/hyperf.php vendor:publish onix-systems-php/hyperf-feature-flags
```

Defining feature flags in config:
---------------------------------

[](#defining-feature-flags-in-config)

> Format: `'name' => 'rule'`

`config/autoload/feature-flags.php`

```
return [
    'slack-integration' => true,
    'my-custom-feature' => "[date:now] > '2024-02-06' && [date:now]  '2050-31-12' || [config:slack.integration] || [feature:my-awesome-feature]",
]
```

What will be the value of this rule?

1. The first part, will evaluate `[date:now] > '2050-31-12'`. Obviously, until `2050-31-12` it will be false.
2. The second part, will evaluate `[config:slack.integration]`. It will take `integration` value from the `config/autoload/slack.php` file if you have. Assume, we don't have `slack-integration` in our config file. So it will be `null`.
3. The third part, will evaluate `[feature:my-awesome-feature]`. Nothing fancy, it will take from our file `/cofnig/autoload/feature_flags.php`, `true` value.
4. Finally, evaluation of this rule `my-custom-feature` will be `false || null || true`. As the result of evaluation will be `true`.

Classes:
--------

[](#classes)

##### OnixSystemsPHP\\HyperfFeatureFlags\\Services\\SetFeatureFlagService

[](#onixsystemsphphyperffeatureflagsservicessetfeatureflagservice)

This class allows you to set your feature flag to `feature_flags` table. The method `run()` accepts one argument: `UpdateFeatureFlagDTO` with name and rule of the feature flag. *It checks if the given user can set this feature flag. So you should implement policy logic.*

##### OnixSystemsPHP\\HyperfFeatureFlags\\Services\\ResetFeatureFlagService

[](#onixsystemsphphyperffeatureflagsservicesresetfeatureflagservice)

This class allows you to reset your feature. In simply words it just deletes your flag from the database and redis. The method `run()` accepts one argument: `ResetFeatureFlagDTO` with name and rule of the feature flag. *It checks if the given user can reset this feature flag. So you should implement policy logic.*

##### OnixSystemsPHP\\HyperfFeatureFlags\\Services\\GetCurrentFeatureFlagService

[](#onixsystemsphphyperffeatureflagsservicesgetcurrentfeatureflagservice)

This class allows you to get all current feature flags. The method `run()` returns an associative array with name and value (which evaluates based on rule) of the feature flag.

##### OnixSystemsPHP\\HyperfFeatureFlags\\Services\\GetOverriddenFeatureFlagsService

[](#onixsystemsphphyperffeatureflagsservicesgetoverriddenfeatureflagsservice)

This class allows you to get all overridden features. In simply words it just grab your flags from the database and redis. The method `run()` returns an associative array with name and value of the feature flag.

##### OnixSystemsPHP\\HyperfFeatureFlags\\Services\\GetFeatureFlagService

[](#onixsystemsphphyperffeatureflagsservicesgetfeatureflagservice)

This class allows you to get value of your rule. Firstly, it goes to redis and checks if it presents in it, then if yes takes it. Secondly if no, goes to database if there is any flag with this name if yes, takes it. Finally, goes to the config and return evaluated rule from the config even if there is such rule in config, it simply returns `false`, in any of these cases it stores value to redis.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

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

Every ~12 days

Total

2

Last Release

819d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8e1c2e991197c9603eb160eb27e1be423eb683ee2eed293288993936444c20bb?d=identicon)[onix-systems-php](/maintainers/onix-systems-php)

---

Top Contributors

[![ihorrudnix](https://avatars.githubusercontent.com/u/144118594?v=4)](https://github.com/ihorrudnix "ihorrudnix (17 commits)")[![vmikhav](https://avatars.githubusercontent.com/u/11061723?v=4)](https://github.com/vmikhav "vmikhav (2 commits)")

---

Tags

phphyperffeature-flags

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/onix-systems-php-hyperf-feature-flags/health.svg)

```
[![Health](https://phpackages.com/badges/onix-systems-php-hyperf-feature-flags/health.svg)](https://phpackages.com/packages/onix-systems-php-hyperf-feature-flags)
```

###  Alternatives

[hyperf/watcher

Hot reload watcher for Hyperf

17846.7k27](/packages/hyperf-watcher)

PHPackages © 2026

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