Download the PHP package pelock/yii2-anti-spam-form without Composer
On this page you can find all versions of the php package pelock/yii2-anti-spam-form. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package yii2-anti-spam-form
Anti-Spam Form for Yii2 Framework
Anti-Spam Form is a form replacement component for the Yii2 Framework for creating anti-spam forms that are invisible in HTML code to spam bots & harvesting tools.
What's the idea behind anti-spam forms?
The concept is simple. Spam bots in most cases are simple tools. They will read your website, look for <form>
HTML tags and artificially fill up the form fields and post it.
The usual spam bot is a web scraper written in Python retrieving raw HTML webpage content without evaluating JS code.
But one thing missed in anti-spam detection methods is that spam bots usually cannot process JavaScript code. For a good reason. It's time-consuming and requires JS interpreter to evaluate the JS code within the web page. And it's not that easy to incorporate JS evaluation without using complex & slower execution engines usually based on Chromium etc.
How to break spam bots?
Simple - put the HTML forms wrapped within JS code. Not the entire form, but the starting <form>
tag with all its properties.
Suddenly the spam bots are unable to find it. Less spam without too much work.
How to install Anti-Spam Form component?
Install it first. Preferred way of WebApi interface installation is via composer.
Run:
Or add this entry:
directly to your composer.json
in require section.
Installation package is available at https://packagist.org/packages/pelock/yii2-anti-spam-form
How to use Anti-Spam Form?
Replace your regular Yii2 ActiveForm
component:
with AntiSpamForm
:
That's all! The forms are going to work exactly the same, the only difference is the output HTML code.
Generated HTML code
What's the difference between the usual ActiveForm
output HTML code and AntiSpamForm
code?
Lets take a look. Before:
After:
The JavaScript code generates output <form>
element with all of its properties. Simple & effective solution against spam bots and web scrapers, harvesters etc.
Should I remove CAPTCHA validations?
No. You should leave your CAPTCHA
verifications in place, because some bots are able to run JS code, so the Anti-Spam Form will provide an additional layer of anti-spam protection.
Bugs, questions, feature requests
Hope you like it. For questions, bug & feature requests visit my site:
Bartosz Wójcik
- Visit my site at — https://www.pelock.com
- Twitter — https://twitter.com/PELock
- GitHub — https://github.com/PELock