{"id":18871750,"url":"https://github.com/sonsofphp/state-machine","last_synced_at":"2026-02-14T07:01:16.505Z","repository":{"id":255440922,"uuid":"851364385","full_name":"SonsOfPHP/state-machine","owner":"SonsOfPHP","description":"[read-only] State Machine Component","archived":false,"fork":false,"pushed_at":"2025-08-22T03:07:25.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-27T16:31:32.725Z","etag":null,"topics":["php","sons-of-php","sonsofphp","state-machine"],"latest_commit_sha":null,"homepage":"https://docs.sonsofphp.com/components/state-machine","language":"PHP","has_issues":false,"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/SonsOfPHP.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},"funding":{"github":"JoshuaEstes","tidelift":"packagist/sonsofphp/sonsofphp","custom":"https://discord.gg/sdVxNhFqND"}},"created_at":"2024-09-03T00:50:45.000Z","updated_at":"2025-08-22T03:07:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"eac23b82-6916-4626-80fb-b8051501fe76","html_url":"https://github.com/SonsOfPHP/state-machine","commit_stats":null,"previous_names":["sonsofphp/state-machine"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/SonsOfPHP/state-machine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SonsOfPHP%2Fstate-machine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SonsOfPHP%2Fstate-machine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SonsOfPHP%2Fstate-machine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SonsOfPHP%2Fstate-machine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SonsOfPHP","download_url":"https://codeload.github.com/SonsOfPHP/state-machine/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SonsOfPHP%2Fstate-machine/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29438976,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T05:24:35.651Z","status":"ssl_error","status_checked_at":"2026-02-14T05:24:34.830Z","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":["php","sons-of-php","sonsofphp","state-machine"],"created_at":"2024-11-08T05:27:14.624Z","updated_at":"2026-02-14T07:01:16.460Z","avatar_url":"https://github.com/SonsOfPHP.png","language":"PHP","funding_links":["https://github.com/sponsors/JoshuaEstes","https://tidelift.com/funding/github/packagist/sonsofphp/sonsofphp","https://discord.gg/sdVxNhFqND"],"categories":[],"sub_categories":[],"readme":"Sons of PHP - State Machine\n===========================\n\n```php\n\u003c?php\n\nuse SonsOfPHP\\Component\\StateMachine\\StateMachine;\n\n$sm = new StateMachine([\n    'graph' =\u003e 'order',\n    'supports' =\u003e [\n        OrderInterface::class,\n    ],\n    'transitions' =\u003e [\n        'create' =\u003e [\n            'from' =\u003e 'draft',\n            'to' =\u003e 'new',\n        ],\n        'fulfill' =\u003e [\n            'from' =\u003e 'new',\n            'to' =\u003e 'fulfilled',\n        ],\n        'cancel' =\u003e [\n            'from' =\u003e ['draft', 'new', 'fulfilled'],\n            'to' =\u003e 'fulfilled',\n        ],\n    ],\n]);\n\n// Check if state can change\n$sm-\u003ecan($order, 'create');\n\n// Apply transition\n$sm-\u003eapply($order, 'fulfil');\n\n// Get Current State\n$sm-\u003egetState($order);\n```\n\n## Learn More\n\n* [Documentation][docs]\n* [Contributing][contributing]\n* [Report Issues][issues] and [Submit Pull Requests][pull-requests] in the [Mother Repository][mother-repo]\n* Get Help \u0026 Support using [Discussions][discussions]\n\n[discussions]: https://github.com/orgs/SonsOfPHP/discussions\n[mother-repo]: https://github.com/SonsOfPHP/sonsofphp\n[contributing]: https://docs.sonsofphp.com/contributing/\n[docs]: https://docs.sonsofphp.com/components/state-machine/\n[issues]: https://github.com/SonsOfPHP/sonsofphp/issues?q=is%3Aopen+is%3Aissue+label%3AStateMachine\n[pull-requests]: https://github.com/SonsOfPHP/sonsofphp/pulls?q=is%3Aopen+is%3Apr+label%3AStateMachine\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsonsofphp%2Fstate-machine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsonsofphp%2Fstate-machine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsonsofphp%2Fstate-machine/lists"}