flags/php-sdk

This package is abandoned and no longer maintained. No replacement package was suggested.
There is no license information available for the latest version (1.0.1) of this package.

An SDK for the Flags application written in PHP.

1.0.1 2018-11-28 19:54 UTC

This package is not auto-updated.

Last update: 2020-01-18 05:34:11 UTC


README

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