Safan Module for Google services
REQUIREMENTS
PHP > 5.4.0
SETUP
If you're using Composer for your project's dependencies, add the following to your "composer.json":, (*1)
"require": {
"safan-lab/google": "1.*"
}
Update Modules Config List - safan-framework-standard/application/Settings/modules.config.php, (*2)
<?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][1], (*3)
<?php
return [
'captcha' => [
'siteKey' => 'your_site_key',
'secretKey' => 'your_secret_key'
]
];
For rendering captcha you can use Safan Object Manager, (*4)
<?= \Safan\Safan::handler()->getObjectManager()->getInstance('Google\Google')->getService('captcha')->render() ?>
For checking data, (*5)
getObjectManager()->getInstance('Google\Google')->getService('captcha');
$response = $googleCaptchaService->check($captchaField);
if($response['status'] === false)
return $response['message'];
?>