1. Go to this page and download the library: Download arodu/util-cake 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/ */
arodu / util-cake example snippets
public function bootstrap(){
parent::bootstrap();
$this->addPlugin('UtilCake');
}
Plugin::load('UtilCake');
public function initialize(){
parent::initialize();
$this->loadComponent('UtilCake.reCaptcha', [
'public_key' => 'RECAPTCHA_PUBLIC_KEY',
'secret_key' => 'RECAPTCHA_SECRET_KEY',
]);
}
public function action(){
// ...
if ($this->request->is('post')) {
if($this->reCaptcha->verify($this->request)){
// when the verification is successful
}else{
// when the verification is not successful
$this->Flash->error(__('reCaptcha failed, try again'));
}
}
// ...
}