{"id":26268173,"url":"https://github.com/ytake/phluxor-saga-example","last_synced_at":"2026-04-23T12:32:57.620Z","repository":{"id":275003222,"uuid":"883150859","full_name":"ytake/phluxor-saga-example","owner":"ytake","description":"This is an example of the Saga pattern implementation for money transfer.","archived":false,"fork":false,"pushed_at":"2025-03-21T16:21:42.000Z","size":37,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-01T10:41:03.874Z","etag":null,"topics":["actor-model","cqrs-es","ddd","domain-driven-design","example","php8","saga","saga-pattern"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ytake.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"ytake","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2024-11-04T13:16:58.000Z","updated_at":"2025-03-22T04:38:01.000Z","dependencies_parsed_at":"2025-03-05T15:38:30.443Z","dependency_job_id":null,"html_url":"https://github.com/ytake/phluxor-saga-example","commit_stats":null,"previous_names":["ytake/phluxor-saga-example"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ytake/phluxor-saga-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ytake%2Fphluxor-saga-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ytake%2Fphluxor-saga-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ytake%2Fphluxor-saga-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ytake%2Fphluxor-saga-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ytake","download_url":"https://codeload.github.com/ytake/phluxor-saga-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ytake%2Fphluxor-saga-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32181371,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-23T11:42:27.955Z","status":"ssl_error","status_checked_at":"2026-04-23T11:42:18.877Z","response_time":53,"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":["actor-model","cqrs-es","ddd","domain-driven-design","example","php8","saga","saga-pattern"],"created_at":"2025-03-14T04:20:11.848Z","updated_at":"2026-04-23T12:32:57.600Z","avatar_url":"https://github.com/ytake.png","language":"PHP","funding_links":["https://github.com/sponsors/ytake"],"categories":[],"sub_categories":[],"readme":"# phluxor-saga-example / Money Transfer Saga\n\nThis example demonstrates how to implement a money transfer saga using Phluxor.\n\n## Protocol Buffers \n\n```bash\n$ protoc -I=./vendor/phluxor/phluxor/protobuf/ --proto_path=protobuf --php_out=src protobuf/*.proto\n```\n\n## Actor Hierarchy in Phluxor Saga Example\n\nThis diagram shows the actor hierarchy in the Phluxor Saga Example project, which implements the Saga pattern using an Actor model toolkit in PHP.\n\n```mermaid\nflowchart TD\n    Root[Root Actor] --\u003e Runner[Runner]\n    \n    %% First hierarchy - Account actors\n    Runner --\u003e Account1[FromAccount]\n    Runner --\u003e Account2[ToAccount]\n    \n    %% Second hierarchy - TransferProcess with Error Kernel Pattern\n    Runner --\u003e TP[TransferProcess]\n    TP --\u003e DA[DebitAttempt\u003cbr\u003eAccountProxy]\n    TP --\u003e CA[CreditAttempt\u003cbr\u003eAccountProxy]\n    TP --\u003e RD[RollbackDebit\u003cbr\u003eAccountProxy]\n    \n    %% Error Kernel Pattern\n    subgraph ErrorKernel1[Error Kernel - Runner]\n        Runner\n        style Runner fill:#f9f,stroke:#333,stroke-width:2px\n    end\n    \n    subgraph ErrorKernel2[Error Kernel - TransferProcess]\n        TP\n        style TP fill:#f9f,stroke:#333,stroke-width:2px\n    end\n    \n    %% Connections\n    DA -.-\u003e Account1\n    CA -.-\u003e Account2\n    RD -.-\u003e Account1\n    \n    %% Legend\n    classDef actor fill:#ddf,stroke:#333,stroke-width:1px\n    class Root,Account1,Account2,DA,CA,RD actor\n    \n    %% Notes\n    note1[Error Kernel Pattern implemented\u003cbr\u003ewith OneForOneStrategy supervision]\n    note1 -.-\u003e ErrorKernel1\n    note1 -.-\u003e ErrorKernel2\n    \n    note2[Saga Pattern implemented through\u003cbr\u003eTransferProcess state machine]\n    note2 -.-\u003e TP\n```\n\n## Explanation\n\n1. **Root Actor**: The system's root actor that spawns the Runner actor.\n\n2. **Runner**: Orchestrates the transfer process by creating Account actors and TransferProcess actors.\n\n3. **Account Actors**: Represent bank accounts with balance operations (credit/debit).\n\n4. **TransferProcess**: Implements the Saga pattern as a state machine with the following states:\n    - Starting\n    - Awaiting Debit Confirmation\n    - Awaiting Credit Confirmation\n    - Rolling Back Debit (compensation)\n\n5. **AccountProxy Actors**: Mediate communication between TransferProcess and Account actors:\n    - DebitAttempt: Attempts to debit the source account\n    - CreditAttempt: Attempts to credit the destination account\n    - RollbackDebit: Compensating action to rollback a debit if credit fails\n\n6. **Error Kernel Pattern**: Implemented through supervision strategies:\n    - Runner uses OneForOneStrategy to supervise TransferProcess actors\n    - TransferProcess uses OneForOneStrategy to supervise AccountProxy actors\n    - This creates a hierarchy where errors are contained and handled at appropriate levels\n\nThe system demonstrates a Saga pattern implementation where a distributed transaction (money transfer) is broken down into a sequence of local transactions with compensating actions for failure scenarios.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fytake%2Fphluxor-saga-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fytake%2Fphluxor-saga-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fytake%2Fphluxor-saga-example/lists"}