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
Requires
- php: ~7.1.0
- ext-curl: *
- cache/filesystem-adapter: *
Requires (Dev)
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
- 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.
- Define the flag you want to evaluate
$flag = new \Flags\Flag($flagIdentifier);
Here, $flagIdentifier
is a string, corresponding to the flag's token.
- 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
-
Clone this repo.
-
Run
composer update
from the root directory. -
Check everything is working by running the tests via
vendor/bin/phpunit