Prevent spammers from ever reading your site
This package is auto-updated.
Last update: 2022-05-11 23:19:22 UTC
This library protects websites from spam and other attacks. It prevents bad bots from delivering their junk, and in many cases, from ever reading your site in the first place.
Welcome to a whole new way of keeping your service, forum, wiki or content management system free of spam and other attacks. Gatekeeper is a PHP-based solution for blocking spam and the robots which deliver it. This keeps your site's load down, makes your site logs cleaner, and can help prevent denial of service conditions caused by spammers.
Gatekeeper also transcends other anti-spam solutions by working in a completely different, unique way. Instead of merely looking at the content of potential spam, Gatekeeper analyzes the delivery method as well as the software the spammer is using. In this way, Gatekeeper can stop spam attacks even when nobody has ever seen the particular spam before.
Gatekeeper is designed to work alongside existing spam prevention services to increase their effectiveness and efficiency. Whenever possible, you should run it in combination with a more traditional spam prevention service.
Include the vendor autoloader and use the classes:
namespace Acme\MyApplication; use FlameCore\Gatekeeper\Screener; use FlameCore\Gatekeeper\Gatekeeper; use FlameCore\Gatekeeper\Listing\IPList; use FlameCore\Gatekeeper\Check\IPBlacklistCheck; use Symfony\Component\HttpFoundation\Request; require 'vendor/autoload.php';
Check object(s) you want to use:
$blacklist = new IPList(['127.0.0.2', '127.0.0.3/32']); $check = new IPBlacklistCheck($blacklist);
Screener object and add the checks to it:
$screener = new Screener(); $screener->setWhitelist(new IPList('127.0.0.1')); $screener->addCheck($check);
Gatekeeper object and run it using the screener:
$request = Request::createFromGlobals(); $gatekeeper = new Gatekeeper(); $gatekeeper->run($request, $screener);
Install Composer if you don't already have it present on your system:
$ curl -sS https://getcomposer.org/installer | php
To install the library, run the following command and you will get the latest development version:
$ php composer.phar require secondtruth/gatekeeper:dev-master
- You must have at least PHP version 5.6 installed on your system.
If you want to contribute, please see the CONTRIBUTING file first.
Thanks to the contributors:
- Christian Neff (secondtruth)
- Michael Hampton