zangane/smart-redirector
Composer 安装命令:
composer require zangane/smart-redirector
包简介
A powerful and flexible PHP redirect handler with time, IP, and user-agent conditions.
README 文档
README
SmartRedirector is a powerful and flexible redirection handler for PHP applications. It allows you to manage HTTP redirects based on time limits, IP rules, user-agent conditions, and more. Ideal for shortlinks, campaign tracking, or dynamic routing.
🔧 Features
- Easy and dynamic redirect rules
- HTTP status code control (301, 302, etc.)
- Expiry date/time support
- IP-based allow/block rules
- User-Agent based redirection
- JSON-based configuration for easy customization
- Composer-ready structure
📦 Installation
composer require zangane/smart-redirector
🧠 Usage
require "vendor/autoload.php"; use Zangane\SmartRedirector\Redirector; $redirector = new Redirector("redirect-rules.json"); $redirector->handle();
⚙️ Configuration (redirect-rules.json)
[
{
"path": "promo",
"target": "https://example.com/promo",
"status": 302,
"expire_at": "2025-12-31 23:59:59",
"ip_allow": ["1.2.3.4"],
"user_agent_block": ["bot", "curl"]
}
]
📁 Directory Structure
- src/
- Redirector.php
- examples/
- basic.php
- redirect-rules.json
- logs/
- access.log
- LICENSE
- README.md
📜 License
MIT License — see the LICENSE file for details.
🧬 Clone This Project
git clone https://github.com/zangane/SmartRedirector.git
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-05-24