{"id":16673799,"url":"https://github.com/patinthehat/backoffv2","last_synced_at":"2025-07-09T06:08:30.786Z","repository":{"id":57036185,"uuid":"82043270","full_name":"patinthehat/BackoffV2","owner":"patinthehat","description":"PHP library implementing various backoff alforithms such as exponential backoff.","archived":false,"fork":false,"pushed_at":"2017-02-16T14:39:20.000Z","size":10,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-02T12:14:20.356Z","etag":null,"topics":["algorithms","backoff","backoff-algorithms","backoff-strategy","composer-package","exponential-backoff","php"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/patinthehat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-15T09:29:00.000Z","updated_at":"2017-03-11T09:52:54.000Z","dependencies_parsed_at":"2022-08-23T20:50:56.524Z","dependency_job_id":null,"html_url":"https://github.com/patinthehat/BackoffV2","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/patinthehat/BackoffV2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patinthehat%2FBackoffV2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patinthehat%2FBackoffV2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patinthehat%2FBackoffV2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patinthehat%2FBackoffV2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/patinthehat","download_url":"https://codeload.github.com/patinthehat/BackoffV2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patinthehat%2FBackoffV2/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264403797,"owners_count":23602621,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithms","backoff","backoff-algorithms","backoff-strategy","composer-package","exponential-backoff","php"],"created_at":"2024-10-12T12:28:13.037Z","updated_at":"2025-07-09T06:08:30.771Z","avatar_url":"https://github.com/patinthehat.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"## BackoffV2 [![Build Status](https://travis-ci.org/patinthehat/BackoffV2.svg?branch=master)](https://travis-ci.org/patinthehat/BackoffV2)\n---\nBackoffV2 is a PHP 5.5+ library implementing various backoff algorithms, such as [exponential backoff](http://en.wikipedia.org/wiki/Exponential_backoff).\n\nThis library only returns a backoff delay amount based on the selected algorithms; implementation of the actual delay mechanism (such as [sleep()](http://php.net/manual/en/function.sleep.php)) is left to the user.\n\n\n---\n#### Installation\n\nInstall BackoffV2 with [Composer](https://getcomposer.org/):\n\n`composer require patinthehat/backoffv2`\n\n---\n#### Implementation\n\n\"Jitter\" is implemented, if you choose to use it.  Jitter is a small, variable amount of time that is added to the backoff amount.\n\n---\nAvailable Jitter algorithms (roughly based on [this post](https://www.awsarchitectureblog.com/2015/03/backoff.html))  include:\n\n - NoJitter - No jitter\n - FullJitter - Standard jitter amount\n - EqualJitter - More consistent jitter amounts\n - DecorrelatedJitter - Higher jitter amounts\n\n---\n Backoff algorithms include:\n \n  - ExponentialBackoff - exponentially increase the backoff amount\n  - ConstantBackoff - use the same backoff amount, regardless of the attempt count.\n  - LinearBackoff - linear increase of the backoff amount, i.e. 1, 2, 3, 4, ...\n\n\n---\n#### Usage\n\n---\n##### Using the Backoff class\n\nBackoffV2 implements a main class, `Backoff`, that acts as a container and manager for the backoff and jitter algorithms you choose.\nThe constructor signature for `Backoff` is: \n```php\npublic function __construct($maxBackoff, BackoffStrategyInterface $backoff, JitterStrategyInterface $jitter)\n```\n\nUsage is simple:\n\n```php\ninclude 'vendor/autoload.php';\nuse BackoffV2\\Backoff;\nuse BackoffV2\\Backoff\\ExponentialBackoff;\nuse BackoffV2\\Jitter\\FullJitter;\n\n$b = new Backoff(15, new ExponentialBackoff, new FullJitter);\n\necho 'backoff = '.$b-\u003egetBackoff() . PHP_EOL;\necho 'backoff = '.$b-\u003egetBackoff() . PHP_EOL;\necho 'backoff = '.$b-\u003egetBackoff() . PHP_EOL;\necho 'backoff = '.$b-\u003egetBackoff() . PHP_EOL;\necho 'backoff = '.$b-\u003egetBackoff() . ' (attempt ' . $b-\u003egetAttempt().')' . PHP_EOL;\n$b-\u003ereset();\n```\n\n---\n#### License\n\nBackoffV2 is available under the [MIT License](LICENSE).\n  ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatinthehat%2Fbackoffv2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatinthehat%2Fbackoffv2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatinthehat%2Fbackoffv2/lists"}