{"id":15068561,"url":"https://github.com/honzamac/conditional-retry","last_synced_at":"2025-04-10T17:41:39.780Z","repository":{"id":56985663,"uuid":"94825213","full_name":"HonzaMac/conditional-retry","owner":"HonzaMac","description":"Retry any third party api call based on you custom conditions","archived":false,"fork":false,"pushed_at":"2017-08-16T20:17:04.000Z","size":8,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T15:21:46.616Z","etag":null,"topics":["failover","php7","retrying"],"latest_commit_sha":null,"homepage":"","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/HonzaMac.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-06-19T22:11:06.000Z","updated_at":"2022-02-12T11:00:38.000Z","dependencies_parsed_at":"2022-08-21T12:20:51.869Z","dependency_job_id":null,"html_url":"https://github.com/HonzaMac/conditional-retry","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HonzaMac%2Fconditional-retry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HonzaMac%2Fconditional-retry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HonzaMac%2Fconditional-retry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HonzaMac%2Fconditional-retry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HonzaMac","download_url":"https://codeload.github.com/HonzaMac/conditional-retry/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248262187,"owners_count":21074260,"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":["failover","php7","retrying"],"created_at":"2024-09-25T01:38:05.368Z","updated_at":"2025-04-10T17:41:39.764Z","avatar_url":"https://github.com/HonzaMac.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Conditional retry\n\nConditionally retry any third party api call.\n\nSometimes network connection is not working properly and we would like to retry api call. Using this tiny library you can easily retry any action based on specific error condition throwed by exception or returned value.\n\n[![Build Status](https://travis-ci.org/HonzaMac/conditional-retry.svg?branch=master)](https://travis-ci.org/HonzaMac/conditional-retry)\n\n\n## Usage\n\nReason for retry is returned via `return $result`. First argument is required api call, second argument is conditional callback, third argument defines how many total runs will api call do.\n```php\n\u003c?php\nrequire __DIR__ . '/vendor/autoload.php';\n\nretryConditional(function () {\n\t$result = $this-\u003esms-\u003esend('+420800100200', 'Help, I\\'m drowning!');\n    return $result;\n}, function ($returnValue) {\n    return !$returnValue;\n}, 3);\n```\n\nReason for retry is returned via `RuntiomeException`.\n```php\n\u003c?php\nrequire __DIR__ . '/vendor/autoload.php';\n\nretryConditional(\n    function () { \n    \t// do stuff\n    \tthrow new \\RuntimeException();\n    },\n    function ($value, $exception) { return $exception instanceof \\RuntimeException;},\n    3\n);\n```\n\nWhen all retries failed, last return value/exception is returned / re-throwed.\nFor more information take a look on tests.\n\n## Requirements\n- PHP 7.0 is required but using the latest version of PHP is highly recommended\n\n## Installation\nYou can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/):\n\n    composer require honzamac/conditional-retry\n\n## Contributing\n\nAny contributions are welcome.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhonzamac%2Fconditional-retry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhonzamac%2Fconditional-retry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhonzamac%2Fconditional-retry/lists"}