PHP code example of tggl / client

1. Go to this page and download the library: Download tggl/client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tggl / client example snippets


use Tggl\Client\TgglClient;
 
// Some class to represent your context
class Context {
  $userId;
  $email;
}
 
$client = new TgglClient('YOUR_API_KEY');
 
// An API call to Tggl is performed here
$flags = $client->evalContext(new Context());
 
if ($flags->isActive('my-feature')) {
  // ...
}
 
if ($flags->get('my-feature') === 'Variation A') {
  // ...
}