{"id":19458847,"url":"https://github.com/leafsphp/shu","last_synced_at":"2026-04-11T21:04:38.409Z","repository":{"id":199984716,"uuid":"702909046","full_name":"leafsphp/Shu","owner":"leafsphp","description":"Shū is an event-driven state library (aka state machine) for your PHP apps","archived":false,"fork":false,"pushed_at":"2023-10-13T10:32:57.000Z","size":16,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-05-23T05:35:26.620Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/leafsphp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"open_collective":"leaf","github":"leafsphp"}},"created_at":"2023-10-10T08:36:36.000Z","updated_at":"2023-12-03T01:06:15.000Z","dependencies_parsed_at":"2023-10-15T00:50:42.801Z","dependency_job_id":null,"html_url":"https://github.com/leafsphp/Shu","commit_stats":null,"previous_names":["leafsphp/shu"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leafsphp%2FShu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leafsphp%2FShu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leafsphp%2FShu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leafsphp%2FShu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leafsphp","download_url":"https://codeload.github.com/leafsphp/Shu/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240662994,"owners_count":19837371,"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":[],"created_at":"2024-11-10T17:28:42.991Z","updated_at":"2026-04-11T21:04:38.373Z","avatar_url":"https://github.com/leafsphp.png","language":"PHP","readme":"\u003c!-- markdownlint-disable no-inline-html --\u003e\n\u003cp align=\"center\"\u003e\n  \u003cbr\u003e\u003cbr\u003e\n  \u003cimg src=\"https://leafphp.dev/logo-circle.png\" height=\"100\"/\u003e\n  \u003cbr\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003eShū\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://packagist.org/packages/leafs/shu\"\n    \u003e\u003cimg\n      src=\"https://poser.pugx.org/leafs/shu/v/stable\"\n      alt=\"Latest Stable Version\"\n  /\u003e\u003c/a\u003e\n  \u003ca href=\"https://packagist.org/packages/leafs/shu\"\n    \u003e\u003cimg\n      src=\"https://poser.pugx.org/leafs/shu/downloads\"\n      alt=\"Total Downloads\"\n  /\u003e\u003c/a\u003e\n  \u003ca href=\"https://packagist.org/packages/leafs/shu\"\n    \u003e\u003cimg\n      src=\"https://poser.pugx.org/leafs/shu/license\"\n      alt=\"License\"\n  /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003cbr /\u003e\n\u003cbr /\u003e\n\nShū is an event-driven state (aka state machine) library for PHP. It is designed to be lightweight, easy to use and easy to extend. Unlike other state libraries, Shū is not bound to any framework and can be used in any PHP project.\n\n## 🗂 Basic Usage\n\nThere are many ways to use Shū. The easiest way is to define your states and events in a state file and then load it into Shū.\n\n```php\n\u003c?php\n\nrequire __DIR__ . '/vendor/autoload.php';\n\n$machine = createMachine([\n    'initial' =\u003e 'pending',\n    'states' =\u003e [\n        'pending',\n        'approved',\n        'rejected',\n    ],\n    'transitions' =\u003e [\n        'approve' =\u003e [\n            'from' =\u003e 'pending',\n            'to' =\u003e 'approved',\n        ],\n        'reject' =\u003e [\n            'from' =\u003e 'pending',\n            'to' =\u003e 'rejected',\n            'action' =\u003e function () {\n                // perform an action and return true if successful\n                return true;\n            },\n        ],\n    ],\n]);\n```\n\n## 💬 Stay In Touch\n\n- [Twitter](https://twitter.com/leafphp)\n- [Join the forum](https://github.com/leafsphp/leaf/discussions/37)\n- [Chat on discord](https://discord.com/invite/Pkrm9NJPE3)\n\n## 📓 Learning Leaf 3\n\n-   Leaf has a very easy to understand [documentation](https://leafphp.dev) which contains information on all operations in Leaf.\n-   You can also check out our [youtube channel](https://www.youtube.com/channel/UCllE-GsYy10RkxBUK0HIffw) which has video tutorials on different topics\n-   You can also learn from [codelabs](https://codelabs.leafphp.dev) and contribute as well.\n\n## 😇 Contributing\n\nWe are glad to have you. All contributions are welcome! To get started, familiarize yourself with our [contribution guide](https://leafphp.dev/community/contributing.html) and you'll be ready to make your first pull request 🚀.\n\nTo report a security vulnerability, you can reach out to [@mychidarko](https://twitter.com/mychidarko) or [@leafphp](https://twitter.com/leafphp) on twitter. We will coordinate the fix and eventually commit the solution in this project.\n\n## 🤩 Sponsoring Leaf\n\nYour cash contributions go a long way to help us make Leaf even better for you. You can sponsor Leaf and any of our packages on [open collective](https://opencollective.com/leaf) or check the [contribution page](https://leafphp.dev/support/) for a list of ways to contribute.\n\nAnd to all our [existing cash/code contributors](https://leafphp.dev#sponsors), we love you all ❤️\n\n## 🤯 Links/Projects\n\n- [Leaf Docs](https://leafphp.dev)\n- [Leaf MVC](https://mvc.leafphp.dev)\n- [Leaf API](https://api.leafphp.dev)\n- [Leaf CLI](https://cli.leafphp.dev)\n- [Aloe CLI](https://leafphp.dev/aloe-cli/)\n","funding_links":["https://opencollective.com/leaf","https://github.com/sponsors/leafsphp"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleafsphp%2Fshu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleafsphp%2Fshu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleafsphp%2Fshu/lists"}