jpkleemans/htaccess-firewall
Composer 安装命令:
composer require jpkleemans/htaccess-firewall
包简介
Simple access control using Htaccess
README 文档
README
Simple access control using Htaccess.
This library is currently under development. Things will change!
Install
Via Composer
$ composer require jpkleemans/htaccess-firewall:dev-master
Usage
First, create an instance of the HtaccessFirewall\HtaccessFirewall class:
$firewall = new HtaccessFirewall('path/to/.htaccess');
Block IP
$host = IP::fromString('123.0.0.1'); $firewall->deny($host);
Unblock IP
$host = IP::fromString('123.0.0.1'); $firewall->undeny($host);
Get all denied hosts
$hosts = $firewall->getDenied();
Deactivate firewall (comment .htaccess lines)
$firewall->deactivate(); // And to reactivate: $firewall->reactivate();
Set 403 message
$hosts = $firewall->set403Message('You are blocked!'); // And to remove: $hosts = $firewall->remove403Message();
Use other filesystem
You can use another filesystem by passing it as the second argument of the HtaccessFirewall constructor.
The filesystem must implement the HtaccessFirewall\Filesystem\Filesystem interface.
$filesystem = new YourCustomFilesystem(); $firewall = new HtaccessFirewall('path/to/.htaccess', $filesystem);
Testing
$ phpspec run
统计信息
- 总下载量: 31
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-09-26