PHPackages                             featurevisor/featurevisor-php - 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. featurevisor/featurevisor-php

ActiveLibrary

featurevisor/featurevisor-php
=============================

Featurevisor SDK for PHP

v0.5.1(8mo ago)391MITPHPPHP ^7.4 || ^8.0CI passing

Since Jul 26Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/featurevisor/featurevisor-php)[ Packagist](https://packagist.org/packages/featurevisor/featurevisor-php)[ Docs](https://featurevisor.com)[ RSS](/packages/featurevisor-featurevisor-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (4)Versions (11)Used By (0)

Featurevisor PHP SDK
=====================

[](#featurevisor-php-sdk-)

This is a port of Featurevisor [Javascript SDK](https://featurevisor.com/docs/sdks/javascript/) v2.x to PHP, providing a way to evaluate feature flags, variations, and variables in your PHP applications.

This SDK is compatible with [Featurevisor](https://featurevisor.com/) v2.0 projects and above.

Table of contents
------------------

[](#table-of-contents-)

- [Installation](#installation)
- [Initialization](#initialization)
- [Evaluation types](#evaluation-types)
- [Context](#context)
    - [Setting initial context](#setting-initial-context)
    - [Setting after initialization](#setting-after-initialization)
    - [Replacing existing context](#replacing-existing-context)
    - [Manually passing context](#manually-passing-context)
- [Check if enabled](#check-if-enabled)
- [Getting variation](#getting-variation)
- [Getting variables](#getting-variables)
    - [Type specific methods](#type-specific-methods)
- [Getting all evaluations](#getting-all-evaluations)
- [Sticky](#sticky)
    - [Initialize with sticky](#initialize-with-sticky)
    - [Set sticky afterwards](#set-sticky-afterwards)
- [Setting datafile](#setting-datafile)
    - [Updating datafile](#updating-datafile)
- [Logging](#logging)
    - [Levels](#levels)
    - [Customizing levels](#customizing-levels)
    - [Handler](#handler)
- [Events](#events)
    - [`datafile_set`](#datafile_set)
    - [`context_set`](#context_set)
    - [`sticky_set`](#sticky_set)
- [Evaluation details](#evaluation-details)
- [Hooks](#hooks)
    - [Defining a hook](#defining-a-hook)
    - [Registering hooks](#registering-hooks)
- [Child instance](#child-instance)
- [Close](#close)
- [CLI usage](#cli-usage)
    - [Test](#test)
    - [Benchmark](#benchmark)
    - [Assess distribution](#assess-distribution)
- [Development of this package](#development-of-this-package)
    - [Setting up](#setting-up)
    - [Running tests](#running-tests)
    - [Releasing](#releasing)
- [License](#license)

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

[](#installation)

In your PHP application, install the SDK using [Composer](https://getcomposer.org/):

```
$ composer require featurevisor/featurevisor-php

```

Initialization
--------------

[](#initialization)

The SDK can be initialized by passing [datafile](https://featurevisor.com/docs/building-datafiles/) content directly:

```
