filipefernandes/laravel-route-retry
Composer 安装命令:
composer require filipefernandes/laravel-route-retry
包简介
A Laravel package to capture and retry failing requests.
README 文档
README
Laravel Route Retry adds a simple and flexible way to capture failed requests (5xx) and retry them later. It's perfect for handling transient failures in webhooks, external API calls, or any critical route.
Installation
You can install the package via composer:
composer require filipefernandes/laravel-route-retry
You can publish the config file with:
php artisan vendor:publish --tag="retry-config"
Then, run the migrations:
php artisan migrate
Usage
Simple Route Retry
You can enable retries on any route using the retry() macro:
use Illuminate\Support\Facades\Route; Route::post('/webhooks/stripe', function () { // If this fails with 5xx, it will be captured })->retry(3); // Retry up to 3 times
Adding Tags
Tags help you filter and process retries for specific features:
Route::post('/sync-data', [SyncController::class, 'handle']) ->retry(5) ->tags(['erp', 'priority-high']);
Processing Retries
To process pending retries, add the following command to your app/Console/Kernel.php:
$schedule->command('retry:process')->everyMinute();
You can also filter retries by tag or ID:
php artisan retry:process --tag=erp php artisan retry:process --id=1 --id=2 --id=3 php artisan retry:process --fingerprint=a8...
Disabling Middleware
If you need to retry requests without running the original route middleware (e.g., if authentication tokens have expired), use the --without-middleware option:
php artisan retry:process --without-middleware
Configuration
The published configuration file config/retry.php allows you to customize:
table_name: The table where retries are stored.storage_disk: The disk used for temporary file storage (defaults tolocal).max_retries: Global default for maximum retry attempts.delay: The initial delay before the first retry attempt.
Events
The package dispatches events throughout the retry lifecycle:
LaravelRouteRetry\Events\RequestCaptured: Dispatched when a failure is first captured.LaravelRouteRetry\Events\RetrySucceeded: Dispatched when a retry attempt results in a 2xx response.LaravelRouteRetry\Events\RetryFailed: Dispatched when a retry fails or reaches the maximum limit.
License
The MIT License (MIT). Please see License File for more information.
filipefernandes/laravel-route-retry 适用场景与选型建议
filipefernandes/laravel-route-retry 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.23k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2026 年 01 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 filipefernandes/laravel-route-retry 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 filipefernandes/laravel-route-retry 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.23k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-09