tallieutallieu/dry-redirects
Composer 安装命令:
composer require tallieutallieu/dry-redirects
包简介
Dry Redirects
README 文档
README
A URL redirection package for the Dry PHP framework. This package allows you to manage redirects through an admin interface and automatically handle URL redirections with parameter support.
Features
- Admin interface for managing redirects
- Support for 301 (permanent), 302 (temporary), and 404 (not found) redirects
- Parameter matching and substitution (e.g.,
/product/{id}→/products/{id}) - Redirect hit tracking and logging
- Database migrations for easy setup
Installation
Via Composer
composer require tallieutallieu/dry-redirects
Service Provider Registration
Add the service provider to your application:
// In your application's service provider registration $app->register(Tnt\Redirects\RedirectServiceProvider::class);
Database Migration
Run the database migrations to create the necessary tables:
php oak migration migrate
Usage
Creating Redirects
Navigate to the admin interface at /admin/redirects and create redirects with:
- Source Path: The URL pattern to match (e.g.,
/old-pathor/product/{id}) - Target Path: The destination URL (e.g.,
/new-pathor/products/{id}) - Status Code: 301 (permanent), 302 (temporary), or 404 (not found)
- Active: Enable/disable the redirect
Parameter Substitution
You can use parameters in your redirects by enclosing them in curly braces:
- Source Path:
/product/{id} - Target Path:
/products/{id}
When a user visits /product/123, they will be redirected to /products/123.
Redirect Logs
The system automatically logs all redirect hits. You can view these logs in the admin interface at /admin/redirects/redirect-logs.
Under the Hood
The package works by:
- Loading all active redirects from the database at application boot
- Registering dynamic routes for each redirect
- When a redirect is triggered:
- Parameters are extracted and substituted
- A
RouteWasHitevent is dispatched (for logging) - The user is redirected to the target URL with the appropriate status code
Administration
The admin interface provides two main sections:
- Redirects: Create, edit, and delete redirects
- Redirect Logs: View and manage redirect hit logs
Requirements
- tallieutallieu/dry: ^v3.1.0
- tallieutallieu/oak: dev-php8.2
License
This package is proprietary software developed by Tallieu & Tallieu.
tallieutallieu/dry-redirects 适用场景与选型建议
tallieutallieu/dry-redirects 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 271 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 03 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 tallieutallieu/dry-redirects 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 tallieutallieu/dry-redirects 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 271
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2021-03-24