Skip to content
This repository has been archived by the owner on Mar 18, 2019. It is now read-only.

bcerban/flags-php-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flags-php-sdk

An SDK for the Flags application written in PHP

Installation

composer require flags/php-sdk

Usage

  1. Obtain an auth token
$user = new \Flags\User($email, $password);
$authorizer = new \Flags\Authorizer();
$authorizer->authorize($user);

The authorizer will return the same user instance with a fresh token.

  1. Define the flag you want to evaluate
$flag = new \Flags\Flag($flagIdentifier);

Here, $flagIdentifier is a string, corresponding to the flag's token.

  1. Evaluate the flag
$evaluator = new \Flags\Evaluator();
$response = $evaluator->evaluate($flag, $user, $applicationUser);
$response->getResult();

Here, $applicationUser is a string representing the application user's identifier.

Demo

You can see a working example by running php examples/demo.php. You will need to provide valid user information in examples/demo.json.

Contributing

  1. Clone this repo.

  2. Run composer update from the root directory.

  3. Check everything is working by running the tests via vendor/bin/phpunit

About

An SDK for the Flags application written in PHP

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages