PHPackages                             spotify/confidence-openfeature-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. spotify/confidence-openfeature-provider

ActiveLibrary

spotify/confidence-openfeature-provider
=======================================

Confidence OpenFeature provider for PHP

v0.0.1(1mo ago)001[1 issues](https://github.com/spotify/confidence-openfeature-provider-php/issues)[1 PRs](https://github.com/spotify/confidence-openfeature-provider-php/pulls)Apache-2.0PHPPHP &gt;=8.2CI passing

Since Jul 7Pushed 2w ago8 watchersCompare

[ Source](https://github.com/spotify/confidence-openfeature-provider-php)[ Packagist](https://packagist.org/packages/spotify/confidence-openfeature-provider)[ RSS](/packages/spotify-confidence-openfeature-provider/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (4)Versions (4)Used By (0)

Confidence OpenFeature PHP Provider
===================================

[](#confidence-openfeature-php-provider)

This repo contains the OpenFeature PHP flag provider for [Confidence](https://confidence.spotify.com/).

Refer to the [Confidence documentation](https://confidence.spotify.com/docs) for more information. Before starting to use the provider, it can be helpful to read through the general [OpenFeature docs](https://docs.openfeature.dev/) and get familiar with the concepts.

This library supports the same platforms as the [OpenFeature PHP SDK](https://github.com/open-feature/php-sdk). Requires PHP &gt;= 8.2.

> **Note:** This provider uses the **online resolver** approach. Flag evaluations are resolved by making API calls to the Confidence backend for each evaluation request. This is different from the [local resolver](https://github.com/spotify/confidence-resolver/) approach used in other Confidence providers (Java, JavaScript, Go) which use WebAssembly (WASM) for local flag evaluation.

Install
-------

[](#install)

```
composer require spotify/confidence-openfeature-provider
```

Usage
-----

[](#usage)

Below is an example for how to create an OpenFeature client using the Confidence flag provider, and then resolve a flag with a boolean attribute. The provider is configured with a **client secret** and a base URL, which will determine where it will send the resolving requests.

The flag will be applied immediately, meaning that Confidence will count the targeted user as having received the treatment.

You can retrieve attributes on the flag variant using property dot notation, meaning `test-flag.boolean-key` will retrieve the attribute `boolean-key` on the flag `test-flag`.

You can also use only the flag name `test-flag` and retrieve all values as an array with `resolveObjectValue()`.

```
