alxsad/stack-ip-firewall

Stack middleware for filtering IP

v1.0 2015-01-19 13:18 UTC

This package is not auto-updated.

Last update: 2024-12-17 05:07:26 UTC


README

Build
Status Latest Stable Version

IpFirewall middleware

Stack middleware to filtering IP.

Intallation

The recommended way to install this library is through Composer:

{
    "require": {
        "alxsad/stack-ip-firewall": "~1.0"
    }
}

Usage

use Symfony\Component\HttpFoundation\Request;

$loader = require_once __DIR__ . '/../app/bootstrap.php.cache';
require_once __DIR__ . '/../app/AppKernel.php';

$kernel = new AppKernel('dev', true);
$kernel->loadClassCache();

$stack = (new Stack\Builder())->push('Alxsad\Stack\IpFirewall', [
  '192.168.1.*',
  '192.168.10.10',
]);

$kernel = $stack->resolve($kernel);

Request::enableHttpMethodParameterOverride();
$request = Request::createFromGlobals();

$response = $kernel->handle($request);
$response->send();

$kernel->terminate($request, $response);

License

This library is released under the MIT License. See the bundled LICENSE file for details.