2017 © Pedro Peláez
 

library referrer-spam

Middleware to block referrer spammers

image

middlewares/referrer-spam

Middleware to block referrer spammers

  • Saturday, June 30, 2018
  • by oscarotero
  • Repository
  • 2 Watchers
  • 2 Stars
  • 15 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

middlewares/referrer-spam

Latest Version on Packagist ![Software License][ico-license] Testing ![Total Downloads][ico-downloads], (*1)

Middleware to block referrer spammers using matomo/referrer-spam-blacklist. It returns a 403 response if the url host in the Referer header is in the blacklist., (*2)

Requirements

ext-intl PHP extension is recommended otherwise symfony/polyfill-intl-idn is used., (*3)

Installation

This package is installable and autoloadable via Composer as middlewares/referrer-spam., (*4)

composer require middlewares/referrer-spam

Usage

By default, use matomo/referrer-spam-blacklist as a list of spammers, (*5)

$spam = new Middlewares\ReferrerSpam();

But you can configure a custom spam list if you don't want to use the default:, (*6)

$spammers = [
    'http://www.0n-line.tv',
    'http://холодныйобзвон.рф',
];

$spam = new Middlewares\ReferrerSpam($spammers);

Optionally, you can provide a Psr\Http\Message\ResponseFactoryInterface as the second argument to create the error responses (403). If it's not defined, Middleware\Utils\Factory will be used to detect it automatically., (*7)

$responseFactory = new MyOwnResponseFactory();

$spam = new Middlewares\ReferrerSpam($spammers, $responseFactory);

Please see CHANGELOG for more information about recent changes and CONTRIBUTING for contributing details., (*8)

The MIT License (MIT). Please see LICENSE for more information., (*9)

The Versions

26/12 2016
27/11 2016