oyeaussie/phpfirewall
Composer 安装命令:
composer require oyeaussie/phpfirewall
包简介
PHPFirewall is a tool to allow/block connections to your web resource using IP address. The IP address details are either retrieved from local database or by making API calls to IP2Location.io
关键字:
README 文档
README
PHPFirewall was awarded 1st prize in the IP2Location Programming Contest 2024 IP2Location Programming Contest 2024
Description:
PHPFirewall is a tool to allow/block connections to your web resource using IP address. The IP address details are either retrieved from local database or by making API calls to IP2Location.io
Why this project?
Internet is ever growing. New devices are coming online everyday which requires the ISPs to add new network range into their system. This makes it quite difficult for firewalls like Cisco or pfsense (linux) to manage policies or know about all networks that are introduced by the ISP of a particular region. Most network hacking happens because of incorrect/failed firewall rules. It's just hard to know all of the network IP ranges of a region.
I wanted to create a firewall application that can be installed on shared hosting, that does not require physical access to the hardware or require a dedicated hardware to run. PHPFirewall can run in a shared hosting environment like Cpanel and it will work just fine. Most Cpanel providers provide access to the users space via SSH, so managing the firewall via CLI is possible.
The whole idea is not to worry about which IP belongs to which part of the world. 1 line should be enough to allow connection from that region and the firewall should take care of the rest of the connections by blocking them. Ip2location.io API along with this application - PHPFirewall, makes this possible.
Code Example:
//In index.php <?php include 'vendor/autoload.php'; //At this point, we assume that firewall configuration and/or IP2location API keys are set! if (!(new \PHPFirewall\Firewall)->checkIp()) { //Send 404 http_response_code(404); exit; } // Rest of your code
Documentation:
Documentation for this repository
Credits:
Thanks to the following projects for their great work. Without them, this project would not be possible.
Composer
Symphony Http Foundation
Ip2location.io - https://www.ip2location.io/
Ip2location PHP Module - https://github.com/chrislim2888/IP2Location-PHP-Module
Ip2location Proxy PHP Module - https://github.com/ip2location/ip2proxy-php
Guzzle - https://github.com/guzzle/guzzle
Flysystem - https://github.com/thephpleague/flysystem
SleekDB - https://github.com/SleekDB/SleekDB
The PHP League CSV - https://github.com/thephpleague/csv
Carbon Date : https://carbon.nesbot.com/
Codeception : https://codeception.com/
PHPUnit : https://phpunit.de/
Issues/Discussions/New features:
Feel free to open an issue in case of a bug or to discuss anything related to the tool or to add a new feature.
Buy Me A Coffee/Beer:
Time is valuable. If you feel this project has been helpful and it has saved your time worth a coffee or a beer...

Hire me:
If you would like to develop a PHP application that requires expert level programming. I am available for hire. Message me and we can discuss further.
Repo Activity:
oyeaussie/phpfirewall 适用场景与选型建议
oyeaussie/phpfirewall 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 55 次下载、GitHub Stars 达 4, 最近一次更新时间为 2024 年 07 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「firewall」 「terminal」 「ip address」 「ip2location」 「ip filter」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 oyeaussie/phpfirewall 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 oyeaussie/phpfirewall 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 oyeaussie/phpfirewall 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A fork of runcmf/runtracy
PHP Terminal emulator controller utilizing ANSI escape sequence coding.
PHP Basic Firewall
Render small SVG icons to monochrome ANSI for terminal UIs (Laravel/Prompts, Symfony Console, plain CLI).
2020 PHP: A showcase and classroom for the cutting edge features of PHP 8
use laravel eloquent, view, pagination anywhere
统计信息
- 总下载量: 55
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 15
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-07-27