Download the PHP package philiprehberger/php-retry without Composer

On this page you can find all versions of the php package philiprehberger/php-retry. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-retry

PHP Retry

Tests Latest Version on Packagist Last updated

Composable retry utility with exponential backoff, jitter, and exception filtering.

Requirements

Installation

Usage

Basic retry

Exponential backoff with jitter

Linear backoff

Constant delay

Exception filtering

Only retry on specific exceptions:

Exclude specific exceptions from retrying:

Conditional Retry

Use shouldRetry() to provide a predicate that receives the exception and attempt number:

Use retryOnlyOn() to retry only for specific exception types:

Retrieve the total number of attempts after execution with getAttempts():

Time budget

Stop retrying after a total time budget is exceeded:

Retry forever (with safety)

Callbacks

Success callback

Checking retry status

API

Method Description
Retry::times(int $maxAttempts) Create a retry builder with a maximum number of attempts
Retry::forever() Create a retry builder that retries indefinitely
->backoff(bool $exponential = true, int $baseMs = 100, int $maxMs = 10000) Configure exponential (or constant when $exponential = false) backoff
->onTimeout(callable $callback) Callback invoked with the last exception (or null) when maxDuration is exceeded
->linear(int $delayMs) Configure linear backoff
->constant(int $delayMs) Configure constant delay
->jitter(bool $enabled) Enable or disable jitter
->onlyIf(callable $predicate) Only retry when predicate returns true
->except(string ...$exceptionClasses) Exclude specific exception types from retrying
->shouldRetry(callable $predicate) Predicate receiving exception and attempt number; return false to stop
->retryOnlyOn(string ...$exceptionClasses) Only retry for the given exception types (sugar for shouldRetry)
->getAttempts() Get the total number of attempts made after execution
->maxDuration(int $ms) Set maximum total duration for all attempts
->beforeRetry(callable $callback) Callback invoked before each retry
->afterRetry(callable $callback) Callback invoked after each attempt
->onSuccess(callable $callback) Callback invoked with RetryResult after successful execution
->run(callable $operation) Execute the operation with retry logic
$result->wasRetried() Returns true if more than one attempt was made
$result->totalDuration() Total elapsed time across all attempts in milliseconds

Development

Support

If you find this project useful:

Star the repo

🐛 Report issues

💡 Suggest features

❤️ Sponsor development

🌐 All Open Source Projects

💻 GitHub Profile

🔗 LinkedIn Profile

License

MIT


All versions of php-retry with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package philiprehberger/php-retry contains the following files

Loading the files please wait ...