PHP code example of yaro / gamstop

1. Go to this page and download the library: Download yaro/gamstop 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/ */

    

yaro / gamstop example snippets


'gamstop' => [
    'key' => env('GAMSTOP_API_KEY'),
],

'providers' => [
    Yaro\Gamstop\ServiceProvider::class,
    //...
];
'aliases' => [
    'Gamstop' => Yaro\Gamstop\Facade::class,
    //...
];

Gamstop::checkParams($firstName, $lastName, $dateOfBirth, $email, $postcode, $xTraceId);

$user = User::first();
$isUserAllowedToPlay = Gamstop::check($user)->isAllowed();

$gamstop = new \Yaro\Gamstop\Gamstop\Api($apiKey);
$response = $gamstop->checkParams($firstName, $lastName, $dateOfBirth, $email, $postcode, $xTraceId);
var_dump($response->isBlocked());

try {
    $response = Gamstop::check($user);
    // ...
} catch (\Yaro\Gamstop\ExceptionsMissingParametersException $e) {
    // if missing parameters
} catch (\Yaro\Gamstop\ExceptionsApiKeyInvalidException $e) {
    // if API key invalid or IP address not in range
} catch (\Yaro\Gamstop\ExceptionsNonPostCallException $e) {
    // for non-POST calls
} catch (\Yaro\Gamstop\ExceptionsRateLimitedException $e) {
    // if rate limited
} catch (\Yaro\Gamstop\NetworkingErrorException $e) {
    // in case of networking error (connection timeout, DNS errors, etc.)
}

try {
    $response = Gamstop::check($user);
    // ...
} catch (\Yaro\Gamstop\GamstopBaseException $e) {
  
}