PHPackages                             0xc/openfeature - 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. 0xc/openfeature

Abandoned → [open-feature/sdk](/?search=open-feature%2Fsdk)Library[Utility &amp; Helpers](/categories/utility)

0xc/openfeature
===============

PHP implementation of the OpenFeature SDK

00PHP

Since Oct 10Pushed 3y ago1 watchersCompare

[ Source](https://github.com/tcarrio/openfeature-php-sdk)[ Packagist](https://packagist.org/packages/0xc/openfeature)[ RSS](/packages/0xc-openfeature/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (5)Used By (0)

OpenFeature SDK for PHP
=======================

[](#openfeature-sdk-for-php)

[![Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://camo.githubusercontent.com/b0f360a81068393f513b910699d643a2e8b05134f22229d0bf417734c17fed2e/68747470733a2f2f7777772e7265706f7374617475732e6f72672f6261646765732f6c61746573742f7769702e737667)](https://www.repostatus.org/#wip)[![Specification](https://camo.githubusercontent.com/f27c189c3f4589dadd7083532080f35de2f839f845483cd379aeb0d79413a929/68747470733a2f2f696d672e736869656c64732e696f2f7374617469632f76313f6c6162656c3d53706563696669636174696f6e266d6573736167653d76302e342e3026636f6c6f723d79656c6c6f77)](https://github.com/open-feature/spec/tree/v0.4.0)[![Latest Stable Version](https://camo.githubusercontent.com/0d2f3e79d75d8ca596b60f20e5eec268eac757ac18199ab7d9b6a8cf0054dde2/687474703a2f2f706f7365722e707567782e6f72672f3078632f6f70656e666561747572652f76)](https://packagist.org/packages/0xc/openfeature)[![Total Downloads](https://camo.githubusercontent.com/878bb0c1efabedc24e95ddcb7625af9f4a8d781ea1e20eff8814619fe6553ac6/687474703a2f2f706f7365722e707567782e6f72672f3078632f6f70656e666561747572652f646f776e6c6f616473)](https://packagist.org/packages/0xc/openfeature)[![License](https://camo.githubusercontent.com/e420edfff2165a0d39f3cd009dab821f82c2dca140beeb263695d41b192dea35/687474703a2f2f706f7365722e707567782e6f72672f3078632f6f70656e666561747572652f6c6963656e7365)](https://packagist.org/packages/0xc/openfeature)

Alpha Checklist
---------------

[](#alpha-checklist)

- spec compliant
- contains test suite which verifies behavior consistent with spec
- contains test suite with reasonable coverage
- automated publishing
- comprehensive readme

Disclaimer
----------

[](#disclaimer)

*I'm throwing this project together as a potential demo-phase of OpenFeature for PHP, with future work surrounding a Split PHP provider (probably utilizing their existing package). It is not complete and is very much work in progress.*

Overview
--------

[](#overview)

This package provides a functional SDK for an OpenFeature API and client. It also builds on various PSRs (PHP Standards Recommendations) such as the Logger interfaces (PSR-3) and the Basic and Extended Coding Standards (PSR-1 and PSR-12).

Future development may aim to allow this library to be auto-loaded by filepath (PSR-4) and optionally integrate with the container standards (PSR-11) over global `$_SESSION` access.

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

[](#installation)

```
$ composer require 0xc/openfeature   // installs the latest version

```

Usage
-----

[](#usage)

While `Boolean` provides the simplest introduction, we offer a variety of flag types.

```
use OpenFeature\OpenFeatureClient;

class MyClass {
  private OpenFeatureClient $client;

  public function __construct() {
    $this->client = OpenFeatureAPI->getInstance()->getClient('MyClass');
  }

  public function booleanExample(): UI
  {
      // Should we render the redesign? Or the default webpage?
      if ($this->client->getBooleanValue('redesign_enabled', false)) {
          return render_redesign();
      }
      return render_normal();
  }

  public function stringExample(): Template
  {
      // Get the template to load for the custom new homepage
      $template = $this->client->getStringValue('homepage_template', 'default-homepage.html');

      return render_template($template);
  }

  public function numberExample(): List
  {
      // How many modules should we be fetching?
      $count = $this->client->getIntegerValue('module-fetch-count', 4);

      return fetch_modules($count);
  }

  public function structureExample(): HomepageModule
  {
      $obj = $this->client->getObjectValue('hero-module', $previouslyDefinedDefaultStructure);

      return HomepageModuleBuilder::new()
              ->title($obj->getValue('title'))
              ->body($obj->getValue('description'))
              ->build();
  }
}
```

### Configuration

[](#configuration)

To configure OpenFeature, you'll need to add a provider to the global singleton `OpenFeatureAPI`. From there, you can generate a `Client` which is usable by your code. If you do not set a provider, then the `NoOpProvider`, which simply returns the default passed in, will be used.

```
use OpenFeature\OpenFeatureAPI;
use OpenFeature\Providers\Flagd\FlagdProvider;

class MyApp {
    public function bootstrap(){
        $api = OpenFeatureAPI.getInstance();
        $api->setProvider(new FlagdProvider());
        $client = $api->getClient();

        // Now use your `$client` instance to evaluate some feature flags!
    }
}
```

Development
-----------

[](#development)

### PHP Versioning

[](#php-versioning)

This library targets PHP version 7.4 and newer. As long as you have any compatible version of PHP on your system you should be able to utilize the OpenFeature SDK.

This package also has a `.tool-versions` file for use with PHP version managers like `asdf`.

### Installation and Dependencies

[](#installation-and-dependencies)

Install dependencies with `composer install`. `composer install` will update the `composer.lock` with the most recent compatible versions.

We value having as few runtime dependencies as possible. The addition of any dependencies requires careful consideration and review.

### Testing

[](#testing)

Run tests with `composer run test`.

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity30

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/37b811aae08f6063ce4a6c9111849a2c8c5400b58718072c224c9eb8c46e5f17?d=identicon)[0xc](/maintainers/0xc)

---

Top Contributors

[![tcarrio](https://avatars.githubusercontent.com/u/8659099?v=4)](https://github.com/tcarrio "tcarrio (2 commits)")

### Embed Badge

![Health badge](/badges/0xc-openfeature/health.svg)

```
[![Health](https://phpackages.com/badges/0xc-openfeature/health.svg)](https://phpackages.com/packages/0xc-openfeature)
```

###  Alternatives

[zhelyabuzhsky/yii2-sitemap

A Yii2 tool to generate sitemap.xml.

3439.7k](/packages/zhelyabuzhsky-yii2-sitemap)[amplifier/yii-amqp

AMQP adapter for Yii

2237.0k](/packages/amplifier-yii-amqp)[bigfork/htmleditorsrcset

Simple srcset integration with SilverStripe’s HTMLEditorField

1025.4k4](/packages/bigfork-htmleditorsrcset)[anasstouaticoder/magento2-module-instantconfigurationcopy

The InstantConfigurationCopy module provides easy way to copy configuration field information for admin in back office Magento 2.

163.8k](/packages/anasstouaticoder-magento2-module-instantconfigurationcopy)

PHPackages © 2026

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