1- [ ![ Build Status] ( https://img.shields.io/github/actions/workflow/status/ctlabvn/Recaptcha/ci.yml )] ( https://github.com/ctlabvn/Recaptcha/actions?query=workflow%3ACI+branch%3Amaster )
2- [ ![ Latest Stable Version] ( https://poser.pugx.org/crabstudio/recaptcha/v/stable )] ( https://packagist.org/packages/crabstudio/recaptcha )
3- [ ![ Total Downloads] ( https://poser.pugx.org/ crabstudio/recaptcha/downloads )] ( https://packagist.org/packages/crabstudio/recaptcha )
4- [ ![ License] ( https://poser.pugx.org/crabstudio/recaptcha/ license )] ( https://packagist.org/packages/crabstudio/recaptcha )
1+ [ ![ Build Status] ( https://img.shields.io/github/actions/workflow/status/ctlabvn/Recaptcha/ci.yml?branch=master )] ( https://github.com/ctlabvn/Recaptcha/actions?query=workflow%3ACI+branch%3Amaster )
2+ [ ![ Latest Stable Version] ( https://img.shields.io/packagist/v/crabstudio/recaptcha )] ( https://packagist.org/packages/crabstudio/recaptcha )
3+ [ ![ Total Downloads] ( https://img.shields.io/packagist/dt/ crabstudio/recaptcha )] ( https://packagist.org/packages/crabstudio/recaptcha )
4+ [ ![ License] ( https://img.shields.io/github/ license/ctlabvn/Recaptcha )] ( https://github.com/ctlabvn/Recaptcha/blob/master/LICENSE )
55
66# Integrate Google Recaptcha v2 to your CakePHP project
77
@@ -11,27 +11,23 @@ You can install this plugin into your CakePHP application using [composer](http:
1111
1212The recommended way to install composer packages is:
1313
14- ```
14+ ``` bash
1515composer require crabstudio/recaptcha
1616```
1717
18- followed by the command:
19-
20- ```
21- composer update
22- ```
23-
2418## Load plugin
2519
2620From command line:
27- ```
21+
22+ ``` bash
2823bin/cake plugin load Recaptcha
2924```
3025
3126## Load Component and Configure
3227
3328Override default configure from loadComponent:
34- ```
29+
30+ ``` php
3531$this->loadComponent('Recaptcha.Recaptcha', [
3632 'enable' => true, // true/false
3733 'sitekey' => 'your_site_key', //if you don't have, get one: https://www.google.com/recaptcha/intro/index.html
@@ -44,8 +40,9 @@ $this->loadComponent('Recaptcha.Recaptcha', [
4440```
4541
4642Override default configure from app config file:
47- ```
48- file: config/app.php
43+
44+ ``` php
45+ // file: config/app.php
4946
5047 /**
5148 * Recaptcha configuration.
@@ -63,10 +60,9 @@ file: config/app.php
6360```
6461
6562Override default configure from recaptcha config file:
66- ```
67- file: config/recaptcha.php
6863
69- <?php
64+ ``` php
65+ // ffile: config/recaptcha.php
7066
7167return [
7268 /**
@@ -86,8 +82,9 @@ return [
8682```
8783
8884Load recaptcha config file:
89- ```
90- file: config/bootstrap.php
85+
86+ ``` php
87+ // file: config/bootstrap.php
9188
9289 Configure::load('recaptcha', 'default', true);
9390```
@@ -100,16 +97,19 @@ Config preference:
10097## Usage
10198
10299Display recaptcha in your view:
103- ```
100+
101+ ``` php
104102 <?= $this->Form->create() ?>
105103 <?= $this->Form->control('email') ?>
106- <?= $this->Recaptcha->display() ?> // Display recaptcha box in your view, if configure has enable = false, nothing will be displayed
104+ // Display recaptcha box in your view, if configure has enable = false, nothing will be displayed
105+ <?= $this->Recaptcha->display() ?>
107106 <?= $this->Form->button() ?>
108107 <?= $this->Form->end() ?>
109108```
110109
111110Verify in your controller function
112- ```
111+
112+ ``` php
113113 public function forgotPassword()
114114 {
115115 if ($this->request->is('post')) {
@@ -121,4 +121,4 @@ Verify in your controller function
121121 }
122122```
123123
124- Done
124+ Done.
0 commit comments