Download the PHP package fostam/retry without Composer

On this page you can find all versions of the php package fostam/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 retry

fostam/retry

With Retry, you can repeat the execution of any callable until it either succeeds, or the maximum number of attempts has been reached. Several delay policies are available for determining the sleep time between the attempts.

Features

Install

The easiest way to install Retry is by using composer:

Usage

`

Payload Callables

Payload callables can be functions, class/object methods or closures, as listed in the PHP documentation.

Failure Condition

Payload callables are considered to have failed if they either throw an Exception or return false. If false is a legitimate result of your callable, use onException() instead of onFailure(), in which case the return value of the callable will be ignored.

The original exception that was thrown in the payload callable is chained to the RetryLimitException and can be retrieved via $e->getPrevious().

You can also use the onCondition() method and pass a validation callable that takes the result of the payload callable as argument and returns true or false to indicate whether the original callable failed or not:

`

Passing Parameters

If you use a function or a class/object method as callable and need to pass parameters, you can wrap the call with a closure:

`

Delay Policies

Retry sleeps between two payload calls. There are multiple policies available to determine the time period of the delay. All numerical values for delay policies are interpreted as milliseconds (ms).

Constant Sleep Value

Linear Sleep Value Increase

Exponential Sleep Value Increase

Fixed Series of Sleep Values

Sleep with Random Jitter

No Sleep

Advanced Features

Omitting Delay Policy

In case you do not want any delay between the attempts, you can either use the NoneDelayPolicy as described above, pass NULL as Delay Policy, or omit the Delay Policy argument at all:

Getting the Number of Attempts

If you need to get the number of attempts that were necessary for a successful payload call, e.g. for logging purposes, you can pass a variable by reference to the onFailure(), onException() and onCondition()methods:

Abort the Retry Loop

To abort the retry loop without signalling "success", an AbortException can be thrown from inside the payload function.


All versions of retry with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
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 fostam/retry contains the following files

Loading the files please wait ....