PHPackages                             harness/ff-server-sdk - 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. [API Development](/categories/api)
4. /
5. harness/ff-server-sdk

ActiveLibrary[API Development](/categories/api)

harness/ff-server-sdk
=====================

PHP Server SDK for integrating with Harness Feature Flag service.

0.2.0-beta(2y ago)0849↓35.3%4[1 issues](https://github.com/harness/ff-php-client-sdk/issues)Apache-2.0PHPPHP &gt;=7.4

Since May 18Pushed 2y ago4 watchersCompare

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

READMEChangelog (2)Dependencies (8)Versions (5)Used By (0)

PHP SDK for Harness Feature Flags
=================================

[](#php-sdk-for-harness-feature-flags)

========================

Table of Contents
-----------------

[](#table-of-contents)

**[Intro](#Intro)**
**[Requirements](#Requirements)**
**[Quickstart](#Quickstart)**
**[Further Reading](docs/further_reading.md)**
**[Development](docs/development.md)**

Intro
-----

[](#intro)

Use this README to get started with our Feature Flags (FF) SDK for PHP. This guide outlines the basics of getting started with the SDK and provides a full code sample for you to try out. This sample doesn’t include configuration options, for in depth steps and configuring the SDK, for example, disabling streaming or using our Relay Proxy, see the PHP SDK Reference.

[![FeatureFlags](https://github.com/harness/ff-php-server-sdk/raw/main/docs/images/ff-gui.png)](https://github.com/harness/ff-php-server-sdk/raw/main/docs/images/ff-gui.png)

Requirements
------------

[](#requirements)

To use this SDK, make sure you’ve:

- installed [PHP](https://www.php.net/) 7.4 or a newer version
- installed [Composer](https://getcomposer.org/)

### General Dependencies

[](#general-dependencies)

- [Relay Proxy](https://github.com/harness/ff-proxy)
- [Redis](https://redis.io/)

Quickstart
----------

[](#quickstart)

To follow along with our test code sample, make sure you’ve:

- [Created a Feature Flag on the Harness Platform](https://ngdocs.harness.io/article/1j7pdkqh7j-create-a-feature-flag) called `harnessappdemodarkmode`
- [Created a server SDK key and made a copy of it](https://ngdocs.harness.io/article/1j7pdkqh7j-create-a-feature-flag#step_3_create_an_sdk_key)
-

### Install the SDK Dependency

[](#install-the-sdk-dependency)

The first step is to install the SDK as a dependency in your application using Composer.

```
composer require harness/ff-server-sdk
```

### Code Sample

[](#code-sample)

The following is a complete code example that you can use to test the `harnessappdemodarkmode` Flag you created on the Harness Platform. When you run the code it will:

- Connect to the FF service.
- Report the value of the Flag on the webpage. Every time the `harnessappdemodarkmode` Flag is toggled on or off on the Harness Platform, the updated value will be updated when the cache refreshes, then refresh the webpage to see the new value.
- Close the SDK.

The example below can also be found in [online\_example.php](https://github.com/harness/ff-php-server-sdk/raw/main/online_example.php).

```
