safan-lab/google
最新稳定版本:1.0.0
Composer 安装命令:
composer require safan-lab/google
包简介
Safan module for Google Services
README 文档
README
REQUIREMENTS
PHP > 5.4.0
SETUP
If you're using Composer for your project's dependencies, add the following to your "composer.json":
"require": {
"safan-lab/google": "1.*"
}
Update Modules Config List - safan-framework-standard/application/Settings/modules.config.php
<?php
return [
...
'Google' => 'vendor/safan-lab/google/Google'
...
];
Captcha
Add new config file with name - safan-framework-standard/application/Settings/google.config.php Official documentation - Google reCaptcha
<?php
return [
'captcha' => [
'siteKey' => 'your_site_key',
'secretKey' => 'your_secret_key'
]
];
For rendering captcha you can use Safan Object Manager
<?= \Safan\Safan::handler()->getObjectManager()->getInstance('Google\Google')->getService('captcha')->render() ?>
For checking data
<?php
// get post data
$captchaField = \Safan\GlobalData\Post::str('g-recaptcha-response');
// check data
$googleCaptchaService = \Safan\Safan::handler()->getObjectManager()->getInstance('Google\Google')->getService('captcha');
$response = $googleCaptchaService->check($captchaField);
if($response['status'] === false)
return $response['message'];
?>
统计信息
- 总下载量: 89
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-08-29