PHPackages                             vend/pheat - 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. vend/pheat

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

vend/pheat
==========

Feature manager

v1.0.0(11y ago)719.3k31MITPHPPHP &gt;=5.5.0

Since Feb 21Pushed 9y agoCompare

[ Source](https://github.com/vend/pheat)[ Packagist](https://packagist.org/packages/vend/pheat)[ RSS](/packages/vend-pheat/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (3)Versions (4)Used By (1)

Pheat
=====

[](#pheat)

PHP 5.4+ Feature Manager
------------------------

[](#php-54-feature-manager)

[![Build Status](https://camo.githubusercontent.com/69bf501a9fc8c943997922e474fc9b6bc9f6281486323ca3ccd9c2c52c27de66/68747470733a2f2f7472617669732d63692e6f72672f76656e642f70686561742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/vend/pheat)[![Code Coverage](https://camo.githubusercontent.com/cc736cd3b947c4dd5584d9b7531b8820673fed68e49695df928543466b273f73/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f76656e642f70686561742f6261646765732f636f7665726167652e706e673f623d6d617374657226733d37303436343731333865663736306163333230663031643065623430323331663961343038326333)](https://scrutinizer-ci.com/g/vend/pheat/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/ec0b5c79a270bb67f253cc7f8aff0d1024f1cf0e7c7560c5cdc5e1869817551e/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f76656e642f70686561742f6261646765732f7175616c6974792d73636f72652e706e673f623d6d617374657226733d37663431663335356533366230663761373333613632393165636163353235616263373532656438)](https://scrutinizer-ci.com/g/vend/pheat/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/469fb229b3fa958ef779a1ae52c934ff5dbd10ba0ce2e39ff2546eff86257139/68747470733a2f2f706f7365722e707567782e6f72672f76656e642f70686561742f762f737461626c652e737667)](https://packagist.org/packages/vend/pheat)[![Latest Unstable Version](https://camo.githubusercontent.com/10dd9609849b703ee3b5f5665535d69cbcceee7b38bb0345526b4e27c39ce1a3/68747470733a2f2f706f7365722e707567782e6f72672f76656e642f70686561742f762f756e737461626c652e737667)](https://packagist.org/packages/vend/pheat)[![License](https://camo.githubusercontent.com/7fa255e6fd66f95c2fd496584b78d4b6447386f02cbd779ee962686395792576/68747470733a2f2f706f7365722e707567782e6f72672f76656e642f70686561742f6c6963656e73652e737667)](https://packagist.org/packages/vend/pheat)

Pheat is a simple implementation of a feature manager for PHP 5.4+. The main abstractions it uses are:

- A `Provider` knows about the status of a list of `Feature` instances
- A `Provider` can vary its list of features based on the `Context`
- A `Manager` can tell you if a specific feature is active or inactive, based on a list of `Provider` instances, by merging their statuses

Installation
------------

[](#installation)

Pheat uses PSR4 for autoloading. It's available as `vend/pheat` on Packagist.

Usage
-----

[](#usage)

### Checking for Features

[](#checking-for-features)

The main instance you'll use for feature management is the `Pheat\Manager`. At its simplest, the manager tells you whether a feature should be treated as active or inactive:

```
if ($manager->resolve('fancy_graphics')) {
    // Output the fancy graphics
}
```

#### Boolean Semantics of Status

[](#boolean-semantics-of-status)

The `resolve` method always returns a boolean or null:

- `true` if the feature should be considered active
- `false` if the feature should be considered inactive
- `null` if nothing is known about the state of the feature

Most of the time, if nothing is known about a feature, you don't want to enable it. So, you can just do a loose "falsish" check on the return value from `resolve`.

#### Advanced Status Information

[](#advanced-status-information)

If you call the manager's `resolveFeature` method you'll receive a `FeatureInterface` instance (rather than a status value). This can be helpful if you need to know *why* a feature is active, because it can tell you which provider is marking it as active.

This is also where you'd implement *variants*, *ratios* or *buckets*: more complex ways of assigning features. The `FeatureInterface` ensures the information about why a feature is active or inactive can be interrogated in more detail.

Configuration
-------------

[](#configuration)

### Manager

[](#manager)

When you create a `Manager`, you'll usually give it a `Context` and a list of `Providers`.

#### Context

[](#context)

The `Context` is a collection of circumstances under which the feature manager is running. The information in the context is what the manager uses to decide whether a feature should be enabled. So, for example, you might have your end-users' usernames in the context: that way, you'd be able to manage features for specific users (or across the pool of users as a percentage).

The `Context` is passed to the `Manager`. Once the `Manager` resolves the current feature list once (and caches it), the manager is locked, and changes to the context won't affect the features. Create a new `Manager` to refresh the features.

You can use the default `Context` implementation (which is a simple array-backed attribute bag), or your own implementation of `ContextInterface`.

#### Providers

[](#providers)

Providers tell the manager which features exist, and when they should be enabled. Providers must implement `Pheat\ProviderInterface`. Providers should be instantiated and added to the manager either when you create it:

```
$manager = new Pheat\Manager($context, [
    new My\Custom\Provider(),
    new My\Other\Provider()
]);
```

Or after it's created:

```
$manager->addProvider(new My\Custom\Provider())
```

Providers are kept and processed in an ordered list (so the order in which you call `addProvider` does matter).

### Feature

[](#feature)

The `Feature` object holds the status for a named feature. It also holds a reference to the provider which gave the information about the feature.

#### `::resolve()`

[](#resolve)

When two or more providers give information about the same feature (according to the feature name), their statuses are merged to find the provider which should 'win' (and control the final value of whether the feature is enabled.) This is done by passing the previously controlling feature into the 'new' feature to be merged's `resolve()` method.

The `resolve()` method returns the `Feature` instance that should now be considered in control. This makes it a good place to implement complex logic, like enabling a feature for a ratio or sample of users.

##### Default Resolution

[](#default-resolution)

When two features are resolved together, in the default implementation, the `Feature` that will end up controlling the status is shown in bold.

Previous StatusNew Status**Active**ActiveActive**Inactive****Active**Unknown**Inactive**Active**Inactive**Inactive**Inactive**UnknownUnknown**Active**Unknown**Inactive****Unknown**Unknown

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

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 ~1 days

Total

3

Last Release

4149d ago

Major Versions

v0.0.1 → v1.0.02015-02-22

PHP version history (2 changes)v0.0.1-alpha1PHP &gt;=5.4.0

v0.0.1PHP &gt;=5.5.0

### Community

Maintainers

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/vend-pheat/health.svg)

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

###  Alternatives

[symfony/lock

Creates and manages locks, a mechanism to provide exclusive access to a shared resource

514139.2M691](/packages/symfony-lock)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[ecotone/ecotone

Enterprise architecture layer for Laravel and Symfony — CQRS, Event Sourcing, Durable Workflows (Sagas, Orchestrators), Projections, and Outbox messaging via PHP attributes.

564576.7k52](/packages/ecotone-ecotone)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k43](/packages/civicrm-civicrm-core)[illuminate/broadcasting

The Illuminate Broadcasting package.

7127.2M208](/packages/illuminate-broadcasting)[logiscape/mcp-sdk-php

Model Context Protocol SDK for PHP

368116.8k12](/packages/logiscape-mcp-sdk-php)

PHPackages © 2026

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