2017 © Pedro Peláez
 

library stack-ip-restrict

Stack middleware for allowing application access for specific IP addresses

image

alsar/stack-ip-restrict

Stack middleware for allowing application access for specific IP addresses

  • Tuesday, January 2, 2018
  • by alsar
  • Repository
  • 2 Watchers
  • 30 Stars
  • 1,970 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 6 Forks
  • 1 Open issues
  • 4 Versions
  • 2 % Grown

The README.md

IpRestrict Stack middleware

Stack middleware to restrict application access for specific IP addresses., (*1)

Usage

Silex example

require __DIR__ . '/../vendor/autoload.php';

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Alsar\Stack\IpRestrict;

$app = new Silex\Application();

$app->get('/', function(Request $request) {
    return new Response('Hello world!', 200);
});

$app = (new Stack\Builder())
    ->push('Alsar\Stack\IpRestrict', ['127.0.0.1'])
    ->resolve($app)
;

$request = Request::createFromGlobals();
$response = $app->handle($request)->send();

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

Symfony example

# web/app_dev.php

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Debug\Debug;

$loader = require_once __DIR__.'/../app/bootstrap.php.cache';
Debug::enable();

require_once __DIR__.'/../app/AppKernel.php';

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

$stack = (new Stack\Builder())
    ->push('Alsar\Stack\IpRestrict', ['127.0.0.1', 'fe80::1', '::1']);

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

Request::enableHttpMethodParameterOverride();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);

Intallation

The recommended way to install this library is through Composer:, (*2)

json { "require": { "alsar/stack-ip-restrict": "~1.0" } }, (*3)

License

This library is released under the MIT License. See the bundled LICENSE file for details., (*4)

The Versions

02/01 2018

dev-master

9999999-dev

Stack middleware for allowing application access for specific IP addresses

  Sources   Download

MIT

The Requires

 

The Development Requires

stack ip restrict stack middleware

02/01 2018

v1.0.1

1.0.1.0

Stack middleware for allowing application access for specific IP addresses

  Sources   Download

MIT

The Requires

 

The Development Requires

stack ip restrict stack middleware

13/02 2014

v1.0.0

1.0.0.0

Stack middleware for allowing application access for specific IP addresses

  Sources   Download

MIT

The Requires

 

The Development Requires

stack ip restrict stack middleware

19/07 2013

v0.1

0.1.0.0

  Sources   Download

The Requires

 

The Development Requires