2017 © Pedro Peláez
 

mako-package makorecaptcha

Google reCaptcha Package for Mako Framework 4.0

image

aldoanizio/makorecaptcha

Google reCaptcha Package for Mako Framework 4.0

  • Tuesday, July 29, 2014
  • by aldoanizio
  • Repository
  • 1 Watchers
  • 0 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Mako ReCaptcha

Google reCaptcha Package for Mako Framework 4.0., (*1)

Install

Use composer to install. Simply add package to your project., (*2)

composer require aldoanizio/makorecaptcha:*

So now you can update your project and install package with a single command., (*3)

composer update

Register Service

After installing you'll have to register a new service in your app/config/application.php file., (*4)

    /**
     * Services to register in the dependecy injection container.
     */

    'services' =>
    [
        ....
        'makorecaptcha\service\ReCaptchaService',
    ],

Configuring

There are two ways to configure your package. The first is editing config file directly in packages folder: app/packages/makorecaptcha/config/config.php and input the necessary information., (*5)

If you like you can copy the package's config file app/packages/makorecaptcha/config/config.php into app/config/packages/makorecaptcha folder and the application will load that file instead of the one located in the package. This makes it possible to update the package while keeping your custom settings., (*6)

Assign variable template

Before use make use of captcha is needed to assign the makoReCaptcha instance to a new variable in template views., (*7)

$this->view->assign('makoReCaptcha', $this->makoReCaptcha);

Display Captcha Form

To make the reCAPTCHA widget appear when your page loads, simply call the html method in your, (*8)

<, (*9)

form> element., (*10)



html(); ?>

Validate submited data

To verify submited data you'll need to use the check method parsing 3 parameters., (*11)

The first parameter is the requested address ip., (*12)

The second parameter is the auto-generated recaptcha_challenge_field field., (*13)

The third parameter is the recaptcha_response_field wich contains the input data., (*14)

$captcha = $this->makoReCaptcha->check($this->request->server('REMOTE_ADDR'), $this->request->post('recaptcha_challenge_field'), $this->request->post('recaptcha_response_field'));

Now you need to check if the input data is valid using the isValid method., (*15)

if($captcha->isValid())
{
    // Lets Go!!
}
else
{
    // Wow, hang on dude!!
}

You can also use the isInvalid method., (*16)

if($captcha->isInvalid())
{
    // Wow, hang on dude!!
}
else
{
    // Lets Go!!
}

The Versions

29/07 2014

dev-master

9999999-dev https://github.com/aldoanizio/makorecaptcha

Google reCaptcha Package for Mako Framework 4.0

  Sources   Download

The Requires

 

mail framework mako