Unleash / unleash-client-php-wip

PHP client for Unleash
Apache License 2.0
11 stars 14 forks source link

unleash-client-php

PHP client for Unleash

Important

THIS IS NOT READY TO BE USED YET! If you want to have a PHP client for Unleaseh, please contribute!

This client will only happen if someone wants to contribute. Just create an issue reuest if you are interested in contributing.

Getting started

Installation

Install the library via composer (currently you need to provide the repository in the composer.json first):

"repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/Unleash/unleash-client-php.git"
        }
    ]

Then you can require the library via the commandline.

composer require unleash/client

Code Usage


// initialize the client
$unleashClient = new \Unleash\Unleash(
        $appName,
        $url,
        $instanceId = null,
);

// to retrieve the current state of the feature flags
$unleashClient->fetch(); 

// check if a feature is enabled
if ($unleashClient->isEnabled('amazing_feature')) {
    echo 'Dude that amazing feature is enabled!';
}

Usage with Unleash

See https://unleash.github.io/ for details.

Usage with Gitlab

See https://docs.gitlab.com/ee/user/project/operations/feature_flags.html for more details.

Running the tests

We use phpunit for testing, which is installed as dev dependency. You can execute the tests by executing

phpunit