yaro/gamstop
Composer 安装命令:
composer require yaro/gamstop
包简介
GAMSTOP package
关键字:
README 文档
README
Package for Gamstop API for checking user's self-exclusion for online gambling.
Installation
You can install the package through Composer.
composer require yaro/gamstop
Usage
Laravel:
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();
Other:
$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) { }
License
The MIT License (MIT). Please see LICENSE for more information.
统计信息
- 总下载量: 1.33k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-04-25