PHPackages                             2dotstwice/silex-feature-toggles-provider - 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. 2dotstwice/silex-feature-toggles-provider

ActiveLibrary

2dotstwice/silex-feature-toggles-provider
=========================================

Feature toggles for Silex

013.3k↓50%1PHP

Since Jul 3Pushed 8y ago4 watchersCompare

[ Source](https://github.com/2dotstwice/silex-feature-toggles-provider)[ Packagist](https://packagist.org/packages/2dotstwice/silex-feature-toggles-provider)[ RSS](/packages/2dotstwice-silex-feature-toggles-provider/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![Build Status](https://camo.githubusercontent.com/509d0c7494b598bf213562007d4981e53edcc8ae1ec88919417cf855ee9ae1cc/68747470733a2f2f7472617669732d63692e6f72672f32646f747374776963652f73696c65782d666561747572652d746f67676c65732d70726f76696465722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/2dotstwice/silex-feature-toggles-provider)

Installation
============

[](#installation)

Service provider
----------------

[](#service-provider)

Register the *FeatureTogglesProvider* with your Silex application. *$featureToggleConfiguration* should be an array with the toggle configuration. You can for example retrieve this from a configuration file, but how to handle that is up to your application.

```
$app->register(
    new \TwoDotsTwice\SilexFeatureToggles\FeatureTogglesProvider(
        $featureToggleConfiguration
    )
);
```

At 2dotstwice, we've been successfully using this together with DerAlex's [YamlConfigServiceProvider](https://github.com/deralex/YamlConfigServiceProvider).

```
$app->register(new \DerAlex\Silex\YamlConfigServiceProvider(__DIR__ . '/config.yml'));

$app->register(
    new \TwoDotsTwice\SilexFeatureToggles\FeatureTogglesProvider(
        $app['config']['toggles']
    )
);
```

The contents of *config.yml* might look like this:

```
toggles:
  profile-date-of-birth:
    name: profile-date-of-birth
    conditions: {}
    status: always-active
  remember-password-option:
    name: remember-password-option
    conditions: {}
    status: inactive
```

For details on the configuration semantics, consult the documentation of Qandidate's [Toggle library](https://github.com/qandidate-labs/qandidate-toggle).

Tiny REST API
-------------

[](#tiny-rest-api)

Additionally, you can add a small REST API which exposes the state of the toggles by mounting the *FeatureTogglesControllerProvider* in your Silex application. This might be useful for manual inspection, or when the state of the toggles is needed on a decoupled front-end.

```
$app->mount('/', new \TwoDotsTwice\SilexFeatureToggles\FeatureTogglesControllerProvider());
```

A request to /toggles will return a JSON response. An example of a response body:

```
{
    "profile-date-of-birth": true,
    "remember-password-option": false
}
```

*true* means the toggle is currently ON, *false* means it is OFF.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 77.8% 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/223a7aec7ce47726d4a7a9df7c6365c883f9452502df2c5752a21adaf5d7039b?d=identicon)[cyberwolf](/maintainers/cyberwolf)

---

Top Contributors

[![cyberwolf](https://avatars.githubusercontent.com/u/95102?v=4)](https://github.com/cyberwolf "cyberwolf (7 commits)")[![bertramakers](https://avatars.githubusercontent.com/u/959026?v=4)](https://github.com/bertramakers "bertramakers (1 commits)")[![WyriHaximus](https://avatars.githubusercontent.com/u/147145?v=4)](https://github.com/WyriHaximus "WyriHaximus (1 commits)")

### Embed Badge

![Health badge](/badges/2dotstwice-silex-feature-toggles-provider/health.svg)

```
[![Health](https://phpackages.com/badges/2dotstwice-silex-feature-toggles-provider/health.svg)](https://phpackages.com/packages/2dotstwice-silex-feature-toggles-provider)
```

PHPackages © 2026

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