cblanquera/cradle-captcha

This package is abandoned and no longer maintained. The author suggests using the cradlephp/cradle-captcha package instead.

Google captcha handler for Cradle

dev-master 2018-03-12 06:57 UTC

This package is auto-updated.

Last update: 2022-02-01 13:00:42 UTC


README

Deprecation Notice: This project has been moved to https://github.com/CradlePHP/cradle-captcha

cradle-captcha

Google Captcha Handling for Cradle

1. Requirements

You should be using CradlePHP currently at dev-master. See https://cradlephp.github.io/ for more information.

2. Install

composer require cblanquera/cradle-captcha

Then in /bootstrap.php, add

->register('cblanquera/cradle-captcha')

3. Setup

Go to https://www.google.com/recaptcha/ and register for a token and secret.

Open /config/services.php and add

'captcha-main' => array(
    'token' => '<Google Token>',
    'secret' => '<Google Secret>'
),

4. Recipes

Once the database is installed open up /public/index.php and add the following.

<?php

use Cradle\Framework\Flow;

return cradle()
    //add routes here
    ->get('/captcha/test', 'Captcha Page')
    ->post('/captcha/test', 'Captcha Process')

    //add flows here
    //renders a table display
    ->flow('Captcha Page',
        Flow::captcha()->load,
        Flow::captcha()->render,
        'TODO: form page'
    )
    ->flow('Captcha Process',
        Flow::captcha()->check,
        array(
            Flow::captcha()->yes,
            'TODO: process'
        ),
        array(
            Flow::captcha()->no,
            'TODO: deny'
        )
    );