2017 © Pedro Peláez
 

library honeypot

A simple spam protection for Laravel 5.5.

image

appel/honeypot

A simple spam protection for Laravel 5.5.

  • Thursday, December 21, 2017
  • by avrahamappel
  • Repository
  • 2 Watchers
  • 2 Stars
  • 39 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 22 % Grown

The README.md

Honeypot: Spam Prevention

A simple spam prevention package for Laravel., (*1)

Installation:

Composer

Run this command inside your terminal to add the package into your project., (*2)

composer require appel/honeypot

Publish Config File and Translations

Publish the package config file and translations to your application. Run this command inside your terminal., (*3)

php artisan vendor:publish --provider="Appel\Honeypot\Providers\HoneypotServiceProvider"

Or, you may want to publish the file individually., (*4)

php artisan vendor:publish --provider="Appel\Honeypot\Providers\HoneypotServiceProvider" --tag="config"
php artisan vendor:publish --provider="Appel\Honeypot\Providers\HoneypotServiceProvider" --tag="lang"

Usage

Facade

Add the honeypot hidden input into your form by inserting Honeypot::make(...) like this:, (*5)

<form action="..." method="...">
    {!! Honeypot::make('honeypot_name', 'honeypot_time') !!}
</form>

Helper Function

<form action="..." method="...">
    {!! honeypot('honeypot_name', 'honeypot_time') !!}
</form>

Blade Directive

<form action="..." method="...">
    @honeypot('honeypot_name', 'honeypot_time')
</form>

Note: If you are using the Blade directive, you may need to run php artisan view:clear for it to work., (*6)

The make() method will output the following HTML input. (The honeypot_time field will generate an encrypted timestamp., (*7)

<div id="honeypot_name_wrap" style="display: none;">
    <input type="text" name="honeypot_name" id="honeypot_name" value="" autocomplete="off">
    <input type="text" name="honeypot_time" id="honeypot_time" value="encrypted timestamp" autocomplete="off">
</div>

After adding the honeypot fields, add the validation rules in your controller for the honeypot and honeytime fields., (*8)

$this->validate($request, [
    ...
    'honeypot_name' => 'honeypot',
    'honeypot_time' => 'required|honeytime:5'
]);

Please note that in the honeytime rule, you need to specify the number of seconds it should take for the user to fill out the form. If it takes less time than that, the form will be rejected., (*9)

Settings

The honeypots are hidden on the page by using display: hidden. You can alternatively have them moved off the page by publishing the config file and changing this setting:, (*10)

return [
    ...
    /**
     * Hide the fields by setting the display property of the outer div to none,
     * or by moving it off-screen. Accepted values: 'hide', 'off-screen'
     */
    'hide_mode'     => 'off-screen'
];

Credits

This project is based on an earlier project by Ian Landsman. The following people contributed to this project: Maksim Surguy, Arjhay Delos Santos, (*11)

This project is sponsored by Bomshteyn Consulting., (*12)

The Versions

21/12 2017

dev-master

9999999-dev

A simple spam protection for Laravel 5.5.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avraham Appel

laravel forms spam honeypot honeytime appel bomshteyn

21/12 2017

v1.1.1

1.1.1.0

A simple spam protection for Laravel 5.5.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avraham Appel

laravel forms spam honeypot honeytime appel bomshteyn

20/12 2017

v1.1.0

1.1.0.0

A simple spam protection for Laravel 5.5.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avraham Appel

laravel forms spam honeypot honeytime appel bomshteyn

24/08 2017

v1.0.2

1.0.2.0

A simple spam protection for Laravel 5.4.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Arjhay Delos Santos

laravel forms spam honeypot devarjhay honeytime

24/08 2017

v1.0.1

1.0.1.0

A simple spam protection for Laravel 5.4.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Arjhay Delos Santos

laravel forms spam honeypot devarjhay honeytime

23/08 2017

v1.0.0

1.0.0.0

A simple spam protection for Laravel 5.4.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Arjhay Delos Santos

laravel forms spam honeypot devarjhay honeytime