PHPackages                             flagception/contentful-activator - 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. flagception/contentful-activator

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

flagception/contentful-activator
================================

Activator for manage feature toggles by contentful

1.0.0(8y ago)11.5kMITPHPPHP ^5.6||^7.0

Since Jan 13Pushed 8y ago3 watchersCompare

[ Source](https://github.com/bestit/flagception-contentful-activator)[ Packagist](https://packagist.org/packages/flagception/contentful-activator)[ RSS](/packages/flagception-contentful-activator/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (8)Versions (2)Used By (0)

Contentful activator for flagception
====================================

[](#contentful-activator-for-flagception)

Manage feature flags for [Flagception](https://packagist.org/packages/flagception/flagception) with [Contentful](https://www.contentful.com/)!

[![Latest Stable Version](https://camo.githubusercontent.com/4229c87a2bb276c78180148e7ca2b12aaff835f4f3aa1d560974e253ed3664b3/68747470733a2f2f706f7365722e707567782e6f72672f666c616763657074696f6e2f636f6e74656e7466756c2d616374697661746f722f762f737461626c65)](https://packagist.org/packages/flagception/contentful-activator)[![Coverage Status](https://camo.githubusercontent.com/c99d1147be24fd99f40effc0ab17a55818f354cbc72e1aa4021aa5df59a8b009/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6265737469742f666c616763657074696f6e2d636f6e74656e7466756c2d616374697661746f722f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/bestit/flagception-contentful-activator?branch=master)[![Build Status](https://camo.githubusercontent.com/2a06f1a9c687993198f26fda9d897f191c531e47b2906e4bdedd3f564783122c/68747470733a2f2f7472617669732d63692e6f72672f6265737469742f666c616763657074696f6e2d636f6e74656e7466756c2d616374697661746f722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/bestit/flagception-contentful-activator)[![Total Downloads](https://camo.githubusercontent.com/3003d36086128bddb47f0f6e491ec19a6c3cedd91d1c77a92de748ca85117784/68747470733a2f2f706f7365722e707567782e6f72672f666c616763657074696f6e2f636f6e74656e7466756c2d616374697661746f722f646f776e6c6f616473)](https://packagist.org/packages/flagception/contentful-activator)[![License](https://camo.githubusercontent.com/0cdda846364b726344a1e73f63f3ae460fd419dffa3f95dca0f4a59ef0635073/68747470733a2f2f706f7365722e707567782e6f72672f666c616763657074696f6e2f636f6e74656e7466756c2d616374697661746f722f6c6963656e7365)](https://packagist.org/packages/flagception/contentful-activator)

[![SensioLabsInsight](https://camo.githubusercontent.com/701578c66954ff698ed18bb030a5cedc646e9df1965918c25bfef4cb0e87526c/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f30313331376666642d623132362d343764332d626564612d3439356361626434363835612f736d616c6c2e706e67)](https://insight.sensiolabs.com/projects/01317ffd-b126-47d3-beda-495cabd4685a)

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 flagception/contentful-activator
```

Usage
-----

[](#usage)

Just create a new `ContentfulActivator` instance and commit it to your feature manager:

```
// YourClass.php

class YourClass
{
    public function run()
    {
        // We need two arguments:
        //  1. A contentful client
        //  2. The content type name in contentful
        $activator = new ContentfulActivator($this->client, 'FeatureToggle');

        $manager = new FeatureManager($activator);
        if ($manager->isActive('your_feature_name')) {
            // do something
        }
    }
}
```

The `ContentfulActivator` need three arguments:

- An instance of a [contentful client](https://packagist.org/packages/contentful/contentful)
- The contentful model type id as string
- The field mappings as array ('name' and 'state') - Optional (default values are set)

If your contentful model looks like this ...

```
{
  "name": "Feature Management",
  "description": "Features verwalten",
  "displayField": "featureName",
  "fields": [
    {
      "id": "featureName",
      "name": "Feature",
      "type": "Text",
      "localized": false,
      "required": true,
      "validations": [],
      "disabled": false,
      "omitted": false
    },
    {
      "id": "isActive",
      "name": "Aktiv",
      "type": "Boolean",
      "localized": false,
      "required": true,
      "validations": [],
      "disabled": false,
      "omitted": false
    }
  ],
  "sys": {
    "space": {
      "sys": {
        "type": "Link",
        "linkType": "Space",
        "id": "9d8smn39"
      }
    },
    "id": "myFeatureModel",
    "type": "ContentType",
    "createdAt": "2017-12-07T15:54:07.255Z",
    "updatedAt": "2018-01-11T16:08:47.283Z",
    //...
  }
}
```

... then your activator instance should be like this:

```
// YourClass.php

class YourClass
{
    public function run()
    {
        // "myFeatureModel" is the content model type
        $activator = new ContentfulActivator($this->client, 'myFeatureModel', [
            'name' => 'featureName', // Field name for feature key
            'state' => 'isActive' // Field name for feature state
        ]);

        $manager = new FeatureManager($activator);
        if ($manager->isActive('your_feature_name')) {
            // do something
        }
    }
}
```

You can skip the field mapping (like the first example) if you use the default field names in contentful:

- 'state' for the feature state field
- 'name' for the feature key field

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

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

3043d ago

### Community

Maintainers

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

![](https://www.gravatar.com/avatar/acc5af332f2a79dedb5aea83c3b4c2665d99fd2c14743fd0c2a3d70ecf0b7859?d=identicon)[best-it](/maintainers/best-it)

---

Top Contributors

[![migo315](https://avatars.githubusercontent.com/u/13180135?v=4)](https://github.com/migo315 "migo315 (7 commits)")

---

Tags

flagceptioncontentfulcontentful-extensionactivator

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/flagception-contentful-activator/health.svg)

```
[![Health](https://phpackages.com/badges/flagception-contentful-activator/health.svg)](https://phpackages.com/packages/flagception-contentful-activator)
```

###  Alternatives

[friendsofphp/php-cs-fixer

A tool to automatically fix PHP code style

13.5k234.7M20.6k](/packages/friendsofphp-php-cs-fixer)[symfony/rate-limiter

Provides a Token Bucket implementation to rate limit input and output in your application

26847.2M147](/packages/symfony-rate-limiter)[symfony/ldap

Provides a LDAP client for PHP on top of PHP's ldap extension

1407.5M46](/packages/symfony-ldap)[php-soap/ext-soap-engine

An ext-soap engine implementation

443.2M7](/packages/php-soap-ext-soap-engine)[flagception/flagception-bundle

Feature toggle bundle on steroids.

283.8M](/packages/flagception-flagception-bundle)[phpbench/container

Simple, configurable, service container.

1512.9M6](/packages/phpbench-container)

PHPackages © 2026

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