|  Download No Captcha Form Spam FilterNo Captcha Form Spam Filter is a PHP utility library for dealing with 
spam bots using unobtrusive and user friendly techniques. Applying this techniques will help to reduce the span in your sites in 
more than 90% and users will not be annoyed with intrusive Captchas or 
extra fields. InstallationYou can download it and place it on your third party libraries folder 
but we highly recommend that you install it through composer. Either run $ composer require daxslab/no-captcha
 or add "daxslab/no-captcha": "~1.0"
 to the requiresection of yourcomposer.jsonfile. The NoCaptchaAntiSpam ClassThe NoCaptchaAntiSpamClass can be used to declare Protection Rules, 
Include security code in forms and check if the form submission does 
not trigger any rule validation. For creating an instance of the NoCaptchaAntiSpamClass, thecreate()static function can be used: 
 use daxslab\nocaptcha\NoCaptchaAntiSpam;
use daxslab\nocaptcha\rules\CssHiddenFieldRule;
// Declare no captcha anti spam object with CSS based hidden field check
$noCaptchaAntiSpam = NoCaptchaAntiSpam::create([
        'rules' => [
            CssHiddenFieldRule::create([
                // form input field name
                'name' => 'css_hidden_field',
            ])
        ],
]);
 Including form elementsUsing the NoCaptchaAntiSpamcreated instance you can include the needed 
elements inside a form with therenderRules()function: <form id="contactForm" method="post">
    <div class="form-group">
        <label for="contactName">Name</label>
        <input class="form-control" name="contact_name" id="contactName" placeholder="Enter name">
    </div>
    
    <!--  Include rules form elements  -->
    <?= $noCaptchaAntiSpam->renderRules() ?>
    
    <button type="submit" name="submit_button" class="btn btn-primary">Submit</button>
</form>    
 Verifying form submissionUsing the checkSubmit()function from theNoCaptchaAntiSpamcreated 
instance you can check if any of the declared Rules triggers when the 
form is submitted: if ($_POST){
    if ($noCaptchaAntiSpam->checkSubmit()){
        echo 'Form submitted correctly';
    } else {
        echo 'Bot detected';
    }
}
 RulesRule classes implements different security checks including:  
`CssHiddenFieldRule`: A honeypot field hidden using CSS
`JavascriptGeneratedHiddenFieldRule`: A honeypot field generated using JavaScript
`JavascriptFilledInputRule`: A JavaScript filled hidden input
`SessionTimeTrapRule`: A time trap using session stored variables
`FormTimeTrapRule`: A time trap using a form field
`CookieCheckRule`: A cookie verification
 A NoCaptchaAntiSpaminstance can contain one or multiple rules. Random field namesRandom field names can be applied for an extra security layer, they are 
stored in PHP sessions and rules field names will change making 
difficult to bots identify them. Random field names can be applied to 
single rules or multiple rules.  DocumentationFor extended documentation and examples you can put the docfolder 
behind a PHP capable web server. |