{"id":16760636,"url":"https://github.com/tabuna/failback","last_synced_at":"2025-04-10T17:38:12.793Z","repository":{"id":57064433,"uuid":"213407186","full_name":"tabuna/failback","owner":"tabuna","description":" Wrapper for creating a branch of inaccessibility.","archived":false,"fork":false,"pushed_at":"2023-07-22T02:18:38.000Z","size":17,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T15:21:33.706Z","etag":null,"topics":["failback","fallback"],"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/tabuna.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-07T14:34:56.000Z","updated_at":"2023-07-24T05:40:26.000Z","dependencies_parsed_at":"2025-02-17T17:46:17.341Z","dependency_job_id":null,"html_url":"https://github.com/tabuna/failback","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tabuna%2Ffailback","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tabuna%2Ffailback/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tabuna%2Ffailback/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tabuna%2Ffailback/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tabuna","download_url":"https://codeload.github.com/tabuna/failback/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248262051,"owners_count":21074239,"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":["failback","fallback"],"created_at":"2024-10-13T04:24:08.253Z","updated_at":"2025-04-10T17:38:12.777Z","avatar_url":"https://github.com/tabuna.png","language":"PHP","readme":"# Actions for Failback\n\nActions for Failback is a lightweight wrapper that empowers you to handle unavailability gracefully.\n\n## Installation\n\nTo install the package, you can use Composer. Simply run the following command:\n\n``` bash\n$ composer require tabuna/failback\n```\n\n## Usage\n\n#### Setting a Default Value:\n\nYou can create an action with a default value using the following code:\n\n```php\nuse Tabuna\\FailBack\\Action;\n\n// $result = 'default';\n$result = Action::make(function () {\n    throw new \\Exception();\n}, 'default')-\u003erun();\n\n// Alternatively, you can use the short helper\n$result = failBack(function () {\n    throw new \\Exception();\n}, 'default')();\n```\n\n#### Adding Fallback Actions:\n\nYou can define multiple fallback actions using the `fail` method:\n\n```php\n// $result = true;\n$result = failBack(function () {\n    throw new \\Exception();\n})-\u003efail(function () {\n    throw new \\Error();\n})-\u003efail(function () {\n    return true;\n})();\n```\n\n#### Utilizing Classes:\n\nTo specify a fallback action using a class, create an anonymous class with an `__invoke` method:\n\n```php\n$class = new class {\n\n    /**\n     * @return bool\n     */\n    public function __invoke(): bool\n    {\n        return true;\n    }\n};\n\n// $result = true;\n$result = failBack(function () {\n    throw new Exception();\n})-\u003efail($class)-\u003erun();\n```\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftabuna%2Ffailback","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftabuna%2Ffailback","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftabuna%2Ffailback/lists"}