jpkleemans/firewall

PHP的简单访问控制

dev-master 2015-09-28 14:58 UTC

This package is auto-updated.

Last update: 2019-12-16 16:31:19 UTC


README

License

PHP的简单访问控制

这个库目前正在开发中。事情会改变。事情会出错。

安装

通过Composer

$ composer require jpkleemans/firewall:dev-master

用法

use Firewall\Adapter\HtaccessAdapter;
use Firewall\Host\IP;

// Create an instance of an adapter that implements the Firewall interface.
$firewall = new HtaccessAdapter('path/to/.htaccess');

// Create an instance of a class that implements the Host interface.
$host = IP::fromString('123.0.0.1');

// Block the host
$firewall->deny($host);

计划适配器

  • Htaccess
  • NGINX
  • IIS
  • HHVM
  • lighttpd
  • PSR-7 中间件

测试

$ phpspec run