2017 © Pedro Peláez
 

library responsive-captcha

Generate mobile-friendly, accessible CAPTCHAs

image

theodorejb/responsive-captcha

Generate mobile-friendly, accessible CAPTCHAs

  • Sunday, April 16, 2017
  • by theodorejb
  • Repository
  • 5 Watchers
  • 8 Stars
  • 14 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Responsive Captcha

Packagist Version, (*1)

Prevent form spam by generating random, accessible arithmetic and logic questions., (*2)

Examples:, (*3)

  • "What is the fourth letter in snowboard?"
  • "What is the sum of four and six?"
  • "What is eight multiplied by two?"
  • "Which is smallest: sixty-six, one hundred, or twenty-two?"

Users can respond with either the numeric or textual version of an answer (e.g. "16" or "sixteen")., (*4)

For background info on this project, see my blog post: https://theodorejb.me/2012/12/30/responsive-captcha/, (*5)

Install via Composer

composer require theodorejb/responsive-captcha, (*6)

Usage

  1. Generate a random question:, (*7)

    use function theodorejb\ResponsiveCaptcha\{randomQuestion, checkAnswer};
    
    $qa = randomQuestion();
    $realAnswer = $qa->getAnswer(); // save somewhere (e.g. in session or encrypted single-use token)
    
  2. Display question in form:, (*8)

    html+php <label> <?= $qa->getQuestion() ?> <input type="text" name="captcha" /> </label>, (*9)

  3. Check whether the user's response is correct:, (*10)

    $answer = filter_input(INPUT_POST, "captcha");
    
    if ($answer !== null) {
        if (checkAnswer($answer, $realAnswer)) {
            // code to execute if the captcha answer is correct
        } else {
            // the answer is incorrect - show an error to the user
        }
    }
    

The Versions

16/04 2017

dev-master

9999999-dev

Generate mobile-friendly, accessible CAPTCHAs

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Theodore Brown

16/04 2017

v3.0.0

3.0.0.0

Generate mobile-friendly, accessible CAPTCHAs

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Theodore Brown

26/02 2016

v2.0.2

2.0.2.0

Generate mobile-friendly, accessible CAPTCHAs

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Theodore Brown

22/01 2015

v2.0.1

2.0.1.0

Generate mobile-friendly, accessible CAPTCHAs

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Theodore Brown

22/09 2014

v2.0.0

2.0.0.0

Generate mobile-friendly, accessible CAPTCHAs

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Theodore Brown