承接 scriptfusion/retry 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

scriptfusion/retry

最新稳定版本:5.0.1

Composer 安装命令:

composer require scriptfusion/retry

包简介

Retries failing operations.

README 文档

README

Latest version Total downloads Build status Test coverage Code style

Retry provides a function to retry failing operations with optional Fiber support. An operation is deemed to have failed if it throws an exception. This library is a rewrite of Igor Wiedler's retry but aims to remain faithful to the spirit of the original.

Requirements

Usage

The retry function retries an operation up to the specified number of times with an optional exception handler.

If an exception handler is specified, it is called immediately before retrying the operation. If the handler returns false, the operation is not retried.

retry(int $times, callable $operation, callable $onError = null); 
  • $times—Maximum number of times the operation may run.
  • $operation—Operation to run up to the specified number of times.
  • $onError—Optional. Exception handler that receives the thrown exception as its first argument.

Note in the original library, $times specifies the number of retries and therefore the operation could run up to $times + 1 times. In this version, $times specifies exactly the number of times the operation may run such that if zero (0) is specified it will not run.

Example

The following code fragment attempts to fetch data from a URL over HTTP up to five times.

use function ScriptFUSION\Retry\retry; $response = retry(5, function () use ($url) { return HttpConnector::fetch($url); });

统计信息

  • 总下载量: 145.09k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 8
  • 点击次数: 0
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 3
  • Forks: 26
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固