jpkleemans/htaccess-firewall 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jpkleemans/htaccess-firewall

Composer 安装命令:

composer require jpkleemans/htaccess-firewall

包简介

Simple access control using Htaccess

README 文档

README

Build Status Code Quality License

SensioLabsInsight

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

GitHub 信息

  • Stars: 3
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-09-26