muyu / no-captcha
A completely useless verification code
Installs: 26
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/muyu/no-captcha
Requires
- php: >=5.5.9
- doctrine/cache: ^1.6
Requires (Dev)
- phpunit/phpunit: ~4.0
- predis/predis: ^1.1
- symfony/var-dumper: ^3.2
This package is not auto-updated.
Last update: 2025-10-26 01:59:06 UTC
README
Building...
How to render page ?
public function getCode()
{
    $ctl = new Template();
    return $ctl->view('code', [
        'generate' => 'http://127.0.0.1/auth/code-generate',
        'valid' => 'http://127.0.0.1/auth/code-valid',
        'query' => 'http://127.0.0.1/auth/code-query',
        'name' => 'Muyu',
        'sign' => 'Inc',
        'message' => '吾,非机器人也',
    ]);
}
How to use ?
private $captcha;
    
public function __construct()
{
    $this->captcha = new Captcha();
    
    /**
     * you can choose
     * useFile | useRedis | useMemcache
     * param is driver connection instance
     */
              
    $this->captcha->useMemcache($memcached);
}
    
public function postLogin()
{
    if(! $this->getCodeQuery())
    {
        throw new Exception('you are robot');
    }
}
    
public function getCodeGenerate()
{
    return $this->captcha->generate();
}
    
public function getCodeValid()
{
    return $this->captcha->valid();
}
    
private function getCodeQuery()
{
    return $this->captcha->query();
}