2017 © Pedro Peláez
 

library slim-access

Access control middleware for Slim framework

image

abouvier/slim-access

Access control middleware for Slim framework

  • Friday, September 25, 2015
  • by abouvier
  • Repository
  • 2 Watchers
  • 8 Stars
  • 30 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Slim Access

Access control middleware for Slim framework., (*1)

Supported formats

  • IPv4 and IPv6 addresses
  • CIDR notation
  • all keyword

Installation

composer require abouvier/slim-access

Usage

Only accept requests from localhost and the 192.168.1.0/24 subnet (except for 192.168.1.42):, (*2)

use \Slim\Middleware\Access;
// ...
$app = new \Slim\Slim();
// ...
$app->add(new Access([
    'callback' => function () use ($app) {
        $app->halt(403, 'You Shall Not Pass!!!');
    },
    'list' => [
        '::1' => Access::ALLOW,
        '127.0.0.1' => Access::ALLOW,
        '192.168.1.42' => Access::DENY,
        '192.168.1.0/24' => Access::ALLOW,
        'all' => Access::DENY // optional as "all" is already denied by default
    ]
]));
// ...
$app->run();

or:, (*3)

$app = new \Slim\Slim();
// ...
$access = new \Slim\Middleware\Access([
    'callback' => function () use ($app) {
        $app->halt(403, 'You Shall Not Pass!!!');
    }
]);
$access->allow('::1')->allow('127.0.0.1')->deny('192.168.1.42')->allow('192.168.1.0/24')->deny('all');
$app->add($access);
// ...
$app->run();

The Versions

25/09 2015

dev-master

9999999-dev https://github.com/abouvier/slim-access

Access control middleware for Slim framework

  Sources   Download

Apache-2.0

The Requires

 

by Avatar abouvier

middleware filter access slim control

15/09 2015

v0.2.0

0.2.0.0 https://github.com/abouvier/slim-access

Access control middleware for Slim framework

  Sources   Download

Apache-2.0

The Requires

 

by Avatar abouvier

middleware filter access slim control

08/09 2015

v0.1.0

0.1.0.0 https://github.com/abouvier/slim-access

Access control middleware for Slim framework

  Sources   Download

Apache-2.0

The Requires

 

by Avatar abouvier

middleware filter access slim control