PHP code example of yassinedoghri / codeigniter-altcha

1. Go to this page and download the library: Download yassinedoghri/codeigniter-altcha 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/ */

    

yassinedoghri / codeigniter-altcha example snippets


   public $helpers = [/*...other helpers...*/, 'altcha'];
   

   public $globals = [
       'before' => [
           // ...
           'altcha' => [
             'except' => ['api*'] // discard paths for which you want to bypass the ALTCHA verification
           ],
       ],
       // ...
   ];
   

   <form method="POST" action="/your-endpoint">
    <!-- Your form fields go here -->

    <?= altcha_widget() 


// new file - app/Config/Altcha.php


declare(strict_types=1);

namespace Config;

// ...
use CodeIgniterAltcha\Config\Altcha as CodeIgniterAltcha;

class Altcha extends CodeIgniterAltcha
{
    // ...
}

altcha_widget(string $ui = 'inline', array $attributes = [], string $children = ''): string​`

  <?= altcha_widget() 

  <?= altcha_widget('floating') 

  <?= altcha_widget('overlay') 

  <?= altcha_widget('inline', ['language' => 'fr']) 

altcha_widget_obfuscate(string $data, array $attributes = [], ?string $customLabel = null, ?string $key = null, ?bool $promptKey = null): string

  <?= altcha_widget_obfuscate('mailto:[email protected]') 

  <?= altcha_widget_obfuscate('tel:+15554441234', [], 'Show phone') 

  <?= altcha_widget_obfuscate('mailto:[email protected]', ['language' => 'de'], 'Kontakt anzeigen')