{"id":36970212,"url":"https://github.com/ulrack/fallback","last_synced_at":"2026-01-13T21:45:50.635Z","repository":{"id":57074936,"uuid":"197270971","full_name":"ulrack/fallback","owner":"ulrack","description":"Fallback system for PHP applications.","archived":true,"fork":false,"pushed_at":"2020-04-09T20:48:01.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-28T12:39:54.027Z","etag":null,"topics":["fallback","php","ulrack"],"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/ulrack.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-16T21:34:08.000Z","updated_at":"2023-01-28T15:06:40.000Z","dependencies_parsed_at":"2022-08-24T14:55:38.390Z","dependency_job_id":null,"html_url":"https://github.com/ulrack/fallback","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/ulrack/fallback","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ulrack%2Ffallback","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ulrack%2Ffallback/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ulrack%2Ffallback/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ulrack%2Ffallback/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ulrack","download_url":"https://codeload.github.com/ulrack/fallback/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ulrack%2Ffallback/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28401084,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T14:36:09.778Z","status":"ssl_error","status_checked_at":"2026-01-13T14:35:19.697Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["fallback","php","ulrack"],"created_at":"2026-01-13T21:45:49.898Z","updated_at":"2026-01-13T21:45:50.627Z","avatar_url":"https://github.com/ulrack.png","language":"PHP","readme":"# DEPRECATION NOTICE: this package has been moved and improved at [grizz-it/fallback](https://github.com/grizz-it/fallback)\n\n[![Build Status](https://travis-ci.com/ulrack/fallback.svg?branch=master)](https://travis-ci.com/ulrack/fallback)\n\n# Ulrack Fallback\n\nThis package contains an implementation for implementing a fallback system\nwithin a PHP application.\n\n## Installation\n\nTo install the package run the following command:\n\n```\ncomposer require ulrack/fallback\n```\n\n## Usage\n\nA single fallback consists of one [FallbackStack](src/Component/FallbackStack.php)\nwith multiple [Fallback](src/Component/Fallback.php)s.\n\n### Creating a Fallback\n\nA fallback can be created by providing it with a callable, a (optional) validator\nand a (optional) set of parameters. The callable will be executed when it is\nreached inside the stack. The validator (see package: ulrack/validator)\nwill be used to verify the output of the callable. The parameters are variadic\nand will override the parameters send by the stack.\n\nAn implementation would look like:\n\n```php\n\u003c?php\n\nuse Ulrack\\Fallback\\Component\\Fallback;\nuse Ulrack\\Validator\\Component\\Logical\\ConstValidator;\n\n$class = new class {\n    /**\n     * Returns the input.\n     *\n     * @param string $input\n     *\n     * @return string\n     */\n    public function foo(string $input): string\n    {\n        return $input;\n    }\n};\n\n$validator = new ConstValidator('bar');\n\n$fallback = new Fallback([$class, 'foo'], $validator);\n```\n\nThe fallback stack can be created after this. The fallback stack takes a\nvalidator as an argument. The function `addFallback` is used to add the fallback\nto the stack. This function takes the Fallback and a position as its arguments.\nThe stack can then be invoked with a set of parameters.\n\n```php\n\u003c?php\n\nuse Ulrack\\Fallback\\Component\\FallbackStack;\nuse Ulrack\\Validator\\Component\\Type\\StringValidator;\n\n$validator = new StringValidator();\n\n$fallbackStack = new FallbackStack($validator);\n\n$fallbackStack-\u003eaddFallback($fallback, 0);\n\n$fallbackStack('bar');\n```\n\n## Change log\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) and [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md) for details.\n\n## MIT License\n\nCopyright (c) 2019 GrizzIT\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fulrack%2Ffallback","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fulrack%2Ffallback","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fulrack%2Ffallback/lists"}