PHP code example of grantholle / laravel-altcha

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

    

grantholle / laravel-altcha example snippets


use GrantHolle\Altcha\Rules\ValidAltcha;

$request->validate([
    'email' => [');

// tests/demoTest.php

it('validates Altcha challenge', function() {
  
    // a "valid" value passes
    $this->post('store-something', [
      'altcha' => config('altcha.testing_bypass')
    ])->assertSessionHasNoErrors();
    
    // but an "invalid" value fails
    $this->post('store-something', [
        'altcha' => 'not valid'
    ])->assertSessionHasErrors('altcha');
    
    // or dynamically set a value for specific tests
    config(['altcha.testing_bypass' => null]);
    
    // still fails because we removed the bypass
    $this->post('store-something', [
        'altcha' => 'valid'
    ])->assertSessionHasErrors('altcha');

});
bash
php artisan vendor:publish --tag="altcha-config"