{"id":42523444,"url":"https://github.com/eljam/circuit-breaker","last_synced_at":"2026-01-28T15:35:25.414Z","repository":{"id":8871499,"uuid":"60015734","full_name":"eljam/circuit-breaker","owner":"eljam","description":"PHP implementation of circuit breaker pattern","archived":false,"fork":false,"pushed_at":"2021-12-10T13:32:00.000Z","size":29,"stargazers_count":17,"open_issues_count":0,"forks_count":11,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-09-20T09:20:18.448Z","etag":null,"topics":["circuit-breaker","microservice","php"],"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/eljam.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":"2016-05-30T14:21:10.000Z","updated_at":"2024-07-09T20:14:47.000Z","dependencies_parsed_at":"2022-07-19T01:47:35.139Z","dependency_job_id":null,"html_url":"https://github.com/eljam/circuit-breaker","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/eljam/circuit-breaker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eljam%2Fcircuit-breaker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eljam%2Fcircuit-breaker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eljam%2Fcircuit-breaker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eljam%2Fcircuit-breaker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eljam","download_url":"https://codeload.github.com/eljam/circuit-breaker/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eljam%2Fcircuit-breaker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28846359,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T15:15:36.453Z","status":"ssl_error","status_checked_at":"2026-01-28T15:15:13.020Z","response_time":57,"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":["circuit-breaker","microservice","php"],"created_at":"2026-01-28T15:35:25.220Z","updated_at":"2026-01-28T15:35:25.400Z","avatar_url":"https://github.com/eljam.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Circuit Breaker\n===============\n\nCircuit breaker is heavily used in microservice architecture to find issues between microservices calls.\n\nThe main idea is to protect your code from making unnecessary call if the microservice you call is down.\n\n\n# Features\n- Automatic update. (i.e you don't have to manually add success or failure method like other library)\n- Return result from the protected function\n- Retry timeout\n- Exclude some exceptions from being throwned, return null instead.\n- Multiprocess updates handled with a cache library. Supports all cache provider from (doctrine cache library).\n- Event powered\n\n[![Build Status](https://img.shields.io/travis/eljam/circuit-breaker.svg?branch=master\u0026style=flat-square)](https://travis-ci.org/eljam/circuit-breaker) [![Code Quality](https://img.shields.io/scrutinizer/g/eljam/circuit-breaker.svg?b=master\u0026style=flat-square)](https://scrutinizer-ci.com/g/eljam/circuit-breaker/?branch=master) [![Code Coverage](https://img.shields.io/coveralls/eljam/circuit-breaker.svg?style=flat-square)](https://coveralls.io/r/eljam/circuit-breaker) [![SensioLabsInsight](https://insight.sensiolabs.com/projects/dd1c1da1-d469-4113-80f3-874c9d1deffd/mini.png)](https://insight.sensiolabs.com/projects/dd1c1da1-d469-4113-80f3-874c9d1deffd) [![Latest Unstable Version](https://poser.pugx.org/eljam/circuit-breaker/v/unstable)](https://packagist.org/packages/eljam/circuit-breaker)\n[![Latest Stable Version](https://poser.pugx.org/eljam/circuit-breaker/v/stable)](https://packagist.org/packages/eljam/circuit-breaker)\n[![Downloads](https://img.shields.io/packagist/dt/eljam/circuit-breaker.svg)](https://packagist.org/packages/eljam/circuit-breaker)\n[![license](https://img.shields.io/packagist/l/eljam/circuit-breaker.svg)](https://github.com/eljam/circuit-breaker/blob/master/LICENSE)\n\n\nFull Example:\n\n```php\n\u003c?php\n\nuse Doctrine\\Common\\Cache\\FilesystemCache;\nuse Eljam\\CircuitBreaker\\Breaker;\nuse Eljam\\CircuitBreaker\\Event\\CircuitEvents;\nuse Symfony\\Component\\EventDispatcher\\Event;\n\nrequire_once __DIR__.'/vendor/autoload.php';\n\n$fileCache  = new FilesystemCache('./store', 'txt');\n\n//Create a circuit for github api with a file cache and we want to exclude all exception.\n$breaker = new Breaker('github_api', ['ignore_exceptions' =\u003e true], $fileCache);\n\n$breaker-\u003eaddListener(CircuitEvents::SUCCESS, function (Event $event) {\n    $circuit = $event-\u003egetCircuit();\n    echo \"Success:\".$circuit-\u003egetFailures().\"\\n\";\n});\n\n$breaker-\u003eaddListener(CircuitEvents::FAILURE, function (Event $event) {\n    $circuit = $event-\u003egetCircuit();\n    echo \"Increment failure:\".$circuit-\u003egetFailures().\"\\n\";\n});\n\n$breaker-\u003eaddListener(CircuitEvents::OPEN, function (Event $event) {\n    $circuit = $event-\u003egetCircuit();\n    echo sprintf(\"circuit %s is open \\n\", $circuit-\u003egetName());\n});\n\n$breaker-\u003eaddListener(CircuitEvents::CLOSED, function (Event $event) {\n    $circuit = $event-\u003egetCircuit();\n    echo sprintf(\"circuit %s is closed \\n\", $circuit-\u003egetName());\n});\n\n$breaker-\u003eaddListener(CircuitEvents::HALF_OPEN, function (Event $event) {\n    $circuit = $event-\u003egetCircuit();\n    echo sprintf(\"circuit %s is half-open \\n\", $circuit-\u003egetName());\n});\n\n$result = $breaker-\u003eprotect(function () {\n    throw new \\Exception(\"An error as occured\");\n    // return 'ok';\n});\n\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feljam%2Fcircuit-breaker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feljam%2Fcircuit-breaker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feljam%2Fcircuit-breaker/lists"}