Download the PHP package silverware/spam-guard without Composer
On this page you can find all versions of the php package silverware/spam-guard. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download silverware/spam-guard
More information about silverware/spam-guard
Files in silverware/spam-guard
Package spam-guard
Short Description SilverWare Spam Guard Module.
License BSD-3-Clause
Homepage https://github.com/praxisnetau/silverware-spam-guard
Informations about the package spam-guard
SilverWare Spam Guard Module
A form spam protection module for SilverStripe v4.
Contents
- Requirements
- Installation
- Configuration
- Usage
- Issues
- Contribution
- Attribution
- Maintainers
- License
Requirements
Installation
Installation is via Composer:
Configuration
As with all SilverStripe modules, configuration is via YAML. An extension to the base Form
class is
applied via config.yml
. Configuration is also used to define the default Spam Guard instance via the
SilverStripe dependency injector:
The default instance SimpleSpamGuard
uses a honeypot approach for preventing spam, combined with a minimum form
submission time, defined by the timeLimit
property.
Usage
Once installed, you can enable simple spam protection on your forms by using the following code:
By using hasMethod
to check for the spam protection method, instead of hasExtension
,
we enable interoperability between this extension and the SilverStripe SpamProtection extension
with no changes required to the form code.
Arguments
The enableSpamProtection
method accepts an optional array of arguments with the following keys:
class
- class of the Spam Guard instance to usename
- name of the Spam Guard form fieldtitle
- title of the Spam Guard form fieldinsertBefore
- insert the Spam Guard form field before a field with this nameinsertAfter
- insert the Spam Guard form field after a field with this name
For example:
Writing your own Spam Guard class
Spam Guard instances must implement the SilverWare\SpamGuard\Interfaces\SpamGuard
interface. Your
implementation must include the following methods:
getFormField()
- answers the form field responsible for spam protectiongetDefaultName()
- answers the default name for the form fieldgetDefaultTitle()
- answers the default title for the form field
Issues
Please use the GitHub issue tracker for bug reports and feature requests.
Contribution
Your contributions are gladly welcomed to help make this project better. Please see contributing for more information.
Attribution
- Inspired by the SilverStripe SpamProtection module.
Maintainers
Colin Tucker | Praxis Interactive |
License
BSD-3-Clause © Praxis Interactive