PHPackages                             playox/feature-tox - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. playox/feature-tox

AbandonedArchivedLib[Testing &amp; Quality](/categories/testing)

playox/feature-tox
==================

Feature toggle on steroids.

0.0.1(3y ago)53.9kMITPHPPHP ^7.4||^8.0

Since Sep 8Pushed 3y agoCompare

[ Source](https://github.com/playox/feature-tox)[ Packagist](https://packagist.org/packages/playox/feature-tox)[ RSS](/packages/playox-feature-tox/feed)WikiDiscussions main Synced today

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

FeatureTox
==========

[](#featuretox)

FeatureTox is a simple and powerful feature toggle library. Only a few lines of configuration necessary - and still very flexible and expandable. This Library is based on  and further developed from us.

[![Latest Stable Version](https://camo.githubusercontent.com/e32bc5dd7fa065a46aae62a9a8bbd106d3789947511123bb0432730abe1de5e8/68747470733a2f2f706f7365722e707567782e6f72672f706c61796f782f666561747572652d746f782f762f737461626c65)](https://packagist.org/packages/playox/feature-tox)[![Testing FeatureTox](https://github.com/playox/feature-tox/actions/workflows/php.yml/badge.svg?branch=main)](https://github.com/playox/feature-tox/actions/workflows/php.yml)[![codecov](https://camo.githubusercontent.com/ceabc7928154d0c0af6ee1254be27cce21c6241e743c53964405fe5dd0044357/68747470733a2f2f636f6465636f762e696f2f67682f706c61796f782f666561747572652d746f782f6272616e63682f6d61696e2f67726170682f62616467652e7376673f746f6b656e3d34335134324139353338)](https://codecov.io/gh/playox/feature-tox)[![Total Downloads](https://camo.githubusercontent.com/38aa8268dc77007e95f9e30f1f519fc69cb59aadccf9a6800f68946173c16262/68747470733a2f2f706f7365722e707567782e6f72672f706c61796f782f666561747572652d746f782f646f776e6c6f616473)](https://packagist.org/packages/playox/feature-tox)[![License](https://camo.githubusercontent.com/6b9afa537c612a091984208b0d652a2d92e1581a31b8d227b6a41d05e0de951d/68747470733a2f2f706f7365722e707567782e6f72672f706c61796f782f666561747572652d746f782f6c6963656e7365)](https://packagist.org/packages/playox/feature-tox)

Download the library
--------------------

[](#download-the-library)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this library:

```
$ composer require playox/FeatureTox
```

Quick example
-------------

[](#quick-example)

Just create a `FeatureManager` instance and pass your activator to start with feature toggling.

```
// MyClass.php
class MyClass
{
    public function doSomething()
    {
        // The activator decide if the feature is active or not
        // You can use your own activator if you implement the interface
        $activator = new ArrayActivator();

        $manager = new FeatureManager($activator);

        if ($manager->isActive('your_feature_name')) {
            // do something
        }
    }
}
```

The activator is the most important class and decide if the given feature is active or not. The `ArrayActivator` needs an array with active feature names as constructor argument. If the requested feature is in array, it will return true otherwise false. Example:

```
// MyClass.php
class MyClass
{
    public function doSomething()
    {
        $activator = new ArrayActivator([
            'feature_abc',
            'feature_def',
            'feature_ghi'
        ]);

        $manager = new FeatureManager($activator);

        // Will return true
        if ($manager->isActive('feature_def')) {
            // do something
        }

        // Will return false
        if ($manager->isActive('feature_wxy')) {
            // do something
        }
    }
}
```

This library ships an [ArrayActivator](docs/activator/array.md), a [ConstraintActivator](docs/activator/constraint.md), a [EnvironmentActivator](docs/activator/environment.md), [CookieActivator](docs/activator/cookie.md)and a [ChainActivator](docs/activator/chain.md).

In most cases you will create your own activator (eg. for doctrine). Just implement the `FeatureActivatorInterface`.

You can use a [CacheActivator](docs/activator/cache.md) if you want to cache the result from some time intensive activators.

Advanced example
----------------

[](#advanced-example)

Sometimes your activator needs more context for deciding if a feature is active or not. You can optionally add a context object as second argument to the manager and check the context data in your activator.

Example:

```
// MyClass.php
class MyClass
{
    public function doSomething(User $user)
    {
        $activator = new YourCustomDoctrineActivator();

        $manager = new FeatureManager($activator);
        $context = new Context();
        $context->add('user_id', $user->getId());

        // Check the feature with context
        if ($manager->isActive('feature_def', $context)) {
            // do something
        }

         // Check the feature without context (result may differ from above)
         if ($manager->isActive('feature_def')) {
             // do something
         }
    }
}

// YourCustomDoctrineActivator.php
class YourCustomDoctrineActivator implements FeatureActivatorInterface
{
    public function isActive($name, Context $context)
    {
        return $context->get('user_id') === 12;
    }
}
```

You can also add the context data globally instead of adding the context to each feature request. Just pass a class which implement the `ContextDecoratorInterface` as second argument for the feature manager constructor:

```
// MyClass.php
class MyClass
{
    public function doSomething(User $user)
    {
        $activator = new YourCustomDoctrineActivator();
        $decorator = new ArrayDecorator([
            'user_id' => $user->getId()
        ]);

        $manager = new FeatureManager($activator, $decorator);

        // Check the feature with the global defined context
        if ($manager->isActive('feature_def')) {
            // do something
        }
    }
}

//YourCustomDoctrineActivator.php
class YourCustomDoctrineActivator implements FeatureActivatorInterface
{
    public function isActive($name, Context $context)
    {
        return $context->get('user_id') === 12;
    }
}
```

You can also mix both variants:

```
// MyClass.php
class MyClass
{
    public function doSomething(User $user)
    {
        $activator = new YourCustomDoctrineActivator();
        $decorator = new ArrayDecorator([
            'user_id' => $user->getId()
        ]);

        $manager = new FeatureManager($activator, $decorator);

        $context = new Context();
        $context->add('user_name', $user->getUsername());

        // Check the feature with the global defined context
        if ($manager->isActive('feature_def', $context)) {
            // do something
        }
    }
}
```

This library ships an [ArrayDecorator](docs/decorator/array.md) and a [ChainDecorator](docs/decorator/chain.md).

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

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

1393d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4624237?v=4)[Thomas Eiling](/maintainers/teiling88)[@teiling88](https://github.com/teiling88)

---

Top Contributors

[![migo315](https://avatars.githubusercontent.com/u/13180135?v=4)](https://github.com/migo315 "migo315 (37 commits)")[![Schleuse](https://avatars.githubusercontent.com/u/2717384?v=4)](https://github.com/Schleuse "Schleuse (7 commits)")[![teiling88](https://avatars.githubusercontent.com/u/4624237?v=4)](https://github.com/teiling88 "teiling88 (7 commits)")[![mKnoop](https://avatars.githubusercontent.com/u/6775586?v=4)](https://github.com/mKnoop "mKnoop (3 commits)")[![ajgarlag](https://avatars.githubusercontent.com/u/388184?v=4)](https://github.com/ajgarlag "ajgarlag (1 commits)")

---

Tags

testingflagsfeaturefeature toggletogglerolloutfeature-flagsFeatureTox

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/playox-feature-tox/health.svg)

```
[![Health](https://phpackages.com/badges/playox-feature-tox/health.svg)](https://phpackages.com/packages/playox-feature-tox)
```

###  Alternatives

[flagception/flagception

Feature toggle on steroids.

154.5M6](/packages/flagception-flagception)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M733](/packages/sylius-sylius)[phpro/grumphp

A composer plugin that enables source code quality checks.

4.3k16.7M1.0k](/packages/phpro-grumphp)[flagception/flagception-bundle

Feature toggle bundle on steroids.

324.0M](/packages/flagception-flagception-bundle)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M203](/packages/sulu-sulu)[dama/doctrine-test-bundle

Symfony bundle to isolate doctrine database tests and improve test performance

1.2k40.8M215](/packages/dama-doctrine-test-bundle)

PHPackages © 2026

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