middlewares/referrer-spam

Middleware to block referrer spammers

v1.2.0 2018-08-04 10:41 UTC

README

Latest Version on Packagist Software License Build Status Quality Score Total Downloads SensioLabs Insight

Middleware to block referrer spammers using piwik/referrer-spam-blacklist. It returns a 403 response if the url host in the Referer header is in the blacklist.

Requirements

Installation

This package is installable and autoloadable via Composer as middlewares/referrer-spam.

composer require middlewares/referrer-spam

Example

$dispatcher = new Dispatcher([
    new Middlewares\ReferrerSpam()
]);

$response = $dispatcher->dispatch(new ServerRequest());

Options

__construct(array $blackList = null)

Allow to configure a custom spam list if you don't want to use the piwik's one.

responseFactory(Psr\Http\Message\ResponseFactoryInterface $responseFactory)

A PSR-17 factory to create 403 responses.

Please see CHANGELOG for more information about recent changes and CONTRIBUTING for contributing details.

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