yaro/gamstop is a Laravel package for gamstop package.
It currently has 0 GitHub stars and 1.329 downloads on Packagist (latest version 0.1.0).
Install it with composer require yaro/gamstop.
Discover more Laravel packages by yaro
or browse all Laravel packages to compare alternatives.
Last updated
Package for Gamstop API for checking user's self-exclusion for online gambling.
You can install the package through Composer.
composer require yaro/gamstop
Just put in your services config file
'gamstop' => [
'key' => env('GAMSTOP_API_KEY'),
],
For Laravel <5.5 add in your app config
'providers' => [
Yaro\Gamstop\ServiceProvider::class,
//...
];
'aliases' => [
'Gamstop' => Yaro\Gamstop\Facade::class,
//...
];
And use like:
Gamstop::checkParams($firstName, $lastName, $dateOfBirth, $email, $postcode, $xTraceId);
or implement GamstopCheckableInterface interface in your model to pass the model.
$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());
You should catch all exceptions
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.)
}
catching this exception will catch any exception that can be thrown:
try {
$response = Gamstop::check($user);
// ...
} catch (\Yaro\Gamstop\GamstopBaseException $e) {
}
The MIT License (MIT). Please see LICENSE for more information.