Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eymengunay/EoHoneypotBundle
Honeypot type for Symfony forms
https://github.com/eymengunay/EoHoneypotBundle
Last synced: about 1 month ago
JSON representation
Honeypot type for Symfony forms
- Host: GitHub
- URL: https://github.com/eymengunay/EoHoneypotBundle
- Owner: eymengunay
- Created: 2013-05-21T16:02:18.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2024-05-16T07:50:08.000Z (7 months ago)
- Last Synced: 2024-10-28T12:13:36.226Z (about 1 month ago)
- Language: PHP
- Homepage: https://github.com/eymengunay/EoHoneypotBundle
- Size: 88.9 KB
- Stars: 34
- Watchers: 1
- Forks: 21
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-honeypots - EoHoneypotBundle - Honeypot type for Symfony2 forms. (Honeypots)
- awesome-honeypots - EoHoneypotBundle - Honeypot type for Symfony2 forms. (Honeypots)
- fucking-awesome-honeypots - EoHoneypotBundle - Honeypot type for Symfony2 forms. (Honeypots)
README
# EoHoneypotBundle
[![Build Status](https://travis-ci.org/eymengunay/EoHoneypotBundle.svg?branch=master)](https://travis-ci.org/eymengunay/EoHoneypotBundle)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/eymengunay/EoHoneypotBundle/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/eymengunay/EoHoneypotBundle/?branch=master)
[![Code Coverage](https://scrutinizer-ci.com/g/eymengunay/EoHoneypotBundle/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/eymengunay/EoHoneypotBundle/?branch=master)
[![Latest Stable Version](https://poser.pugx.org/eo/honeypot-bundle/v/stable.svg)](https://packagist.org/packages/eo/honeypot-bundle)
[![Total Downloads](https://poser.pugx.org/eo/honeypot-bundle/downloads.svg)](https://packagist.org/packages/eo/honeypot-bundle)Honeypot for Symfony2 forms.
## What is Honey pot?
> A honey pot trap involves creating a form with an extra field that is hidden to human visitors but readable by robots.
> The robot fills out the invisible field and submits the form, leaving you to simply ignore their spammy submission or blacklist their IP.
> It’s a very simple concept that can be implemented in a few minutes and it just works – add them to your contact and submission forms to help reduce spam.## Prerequisites
This version of the bundle requires Symfony 2.1+## Installation
### Step 1: Download EoHoneypotBundle using Composer
Add EoHoneypotBundle to your project by running the command:
```bash
$ composer require eo/honeypot-bundle
```Composer will install the bundle to your project's `vendor/eo` directory.
### Step 2: Enable the bundle
If you use Symfony Flex - skip this step. Otherwise, enable the bundle in `bundles.php`:
```php
['all' => true],
];
```### Step 3 (optional): Configure bundle to use database
To save honeypot catched requests into database you have to enable it in your configuration file:
*All parameters are optional*```yaml
# config/packages/eo_honeypot.yaml
eo_honeypot:
storage:
database:
enabled: false
driver: mongodb # orm and mongodb are supported
class: ApplicationEoHoneypotBundle:HoneypotPrey
# You can also use file format to store honeypot preys.
# This may come handy if you need to parse logs with fail2ban
# file:
# enabled: false
# output: /var/log/honeypot.log
redirect:
enabled: true
url: "/"
# route: homepage
# route_parameters: ~
```If you enable the database storage, you must create a class which extends
the `Eo\HoneypotBundle\\HoneypotPrey` base class :```php
id;
}
}```
or
```php
id;
}
}
```## Usage
Once installed and configured you can start using `Eo\HoneypotBundle\Form\Type\HoneypotType`
form type in your forms.### Basic usage example:
```php
add('name', TextType);
$builder->add('email', EmailType);// Honeypot field
$builder->add('SOME-FAKE-NAME', HoneypotType::class);
}
}
```### Events
If the hidden honeypot field has some data bundle will dispatch a `bird.in.cage` event. You can create an event listener to execute custom actions. See [Eo\HoneypotBundle\Event\BirdInCage](https://github.com/eymengunay/EoHoneypotBundle/blob/master/Event/BirdInCageEvent.php) and [How to Register Event Listeners and Subscribers](http://symfony.com/doc/current/cookbook/doctrine/event_listeners_subscribers.html) for more information.
## License
This bundle is under the MIT license. See the complete license in the bundle:
```
Resources/meta/LICENSE
```## Reporting an issue or a feature request
Issues and feature requests related to this bundle are tracked in the Github issue tracker https://github.com/eymengunay/EoHoneypotBundle/issues.