PHP code example of secgin / phalcon-recaptcha-plugin

1. Go to this page and download the library: Download secgin/phalcon-recaptcha-plugin library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

secgin / phalcon-recaptcha-plugin example snippets




return new Phalcon\Config([
    'recaptcha' => [
        'apiUrl' => 'https://www.google.com/recaptcha/api/siteverify', // Zorunlu değil varsayılan olarak bu değeri kullanır
        'siteKey' => '',
        'secretKey' => ''
    ]
]);



class LoginForm extends Form
{
    public function initialize()
    {
        $username = new Text('username');
        $username->setLabel('Username');
        $username->addValidators([
            new PresenceOf(['message' => 'Username is  $password->addValidators([
            new PresenceOf(['message' => 'Password is     new Response(
                [
                    'message' => 'Recaptcha is 


class IndexController extends Controller
{
    public function indexAction()
    {
        $loginForm = new LoginForm();

        if ($this->request->isPost())
        {
            $isValid = $loginForm->isValid($this->request->getPost());

            $userMessage = '';
            if ($isValid)
                $userMessage = 'Login successful';
            else
            {
                foreach ($loginForm->getMessages() as $message)
                    $userMessage .= $message->getMessage() . '<br>';
            }
        }

        $this->view->setVars([
            'form' => new LoginForm(),
            'userMessage' => $userMessage ?? null
        ]);
    }
}