{"id":25440250,"url":"https://github.com/tarfin-labs/event-machine","last_synced_at":"2026-04-01T17:37:18.384Z","repository":{"id":158044024,"uuid":"613786792","full_name":"tarfin-labs/event-machine","owner":"tarfin-labs","description":"Event-driven state machines for Laravel with event sourcing, type-safe context, and full audit trail.","archived":false,"fork":false,"pushed_at":"2026-03-30T10:28:56.000Z","size":5798,"stargazers_count":18,"open_issues_count":7,"forks_count":1,"subscribers_count":6,"default_branch":"main","last_synced_at":"2026-03-30T10:29:46.795Z","etag":null,"topics":["event-sourcing","finite-state-machine","laravel","laravel-package","parallel-states","php","state-machine","xstate"],"latest_commit_sha":null,"homepage":"https://eventmachine.dev","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/tarfin-labs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2023-03-14T09:16:35.000Z","updated_at":"2026-03-30T09:31:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"3f6fe69a-9309-40dd-bc9f-0970203292f9","html_url":"https://github.com/tarfin-labs/event-machine","commit_stats":null,"previous_names":[],"tags_count":77,"template":false,"template_full_name":"spatie/package-skeleton-laravel","purl":"pkg:github/tarfin-labs/event-machine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarfin-labs%2Fevent-machine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarfin-labs%2Fevent-machine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarfin-labs%2Fevent-machine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarfin-labs%2Fevent-machine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tarfin-labs","download_url":"https://codeload.github.com/tarfin-labs/event-machine/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarfin-labs%2Fevent-machine/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31290537,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T13:12:26.723Z","status":"ssl_error","status_checked_at":"2026-04-01T13:12:25.102Z","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":["event-sourcing","finite-state-machine","laravel","laravel-package","parallel-states","php","state-machine","xstate"],"created_at":"2025-02-17T11:30:03.064Z","updated_at":"2026-04-01T17:37:18.375Z","avatar_url":"https://github.com/tarfin-labs.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n\u003cpicture\u003e\n  \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"./art/event-machine-logo-dark.svg\"\u003e\n  \u003cimg alt=\"EventMachine\" src=\"./art/event-machine-logo-light.svg\" height=\"300\"\u003e\n\u003c/picture\u003e\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/tarfin-labs/event-machine.svg?style=flat-square)](https://packagist.org/packages/tarfin-labs/event-machine)\n[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/tarfin-labs/event-machine/ci.yml?branch=main\u0026label=tests\u0026style=flat-square)](https://github.com/tarfin-labs/event-machine/actions?query=workflow%3ACI+branch%3Amain)\n[![Total Downloads](https://img.shields.io/packagist/dt/tarfin-labs/event-machine.svg?style=flat-square)](https://packagist.org/packages/tarfin-labs/event-machine)\n\n**Event-driven state machines for Laravel**\n\n[Documentation](https://eventmachine.dev) · [Installation](#installation) · [Why EventMachine?](#why-eventmachine)\n\n\u003c/div\u003e\n\n---\n\n## Why EventMachine?\n\n**Your business logic deserves better than nested if-statements.**\n\nEventMachine brings the power of finite state machines to Laravel, inspired by [XState](https://xstate.js.org). Define your states, transitions, and behaviors declaratively - and let the machine handle the complexity.\n\n### The Problem\n\n```php\n// Without state machines: scattered conditionals, hidden rules, impossible to test\nif ($order-\u003estatus === 'pending' \u0026\u0026 $user-\u003ecan('approve') \u0026\u0026 !$order-\u003eisExpired()) {\n    if ($order-\u003etotal \u003e 10000 \u0026\u0026 !$order-\u003ehasSecondApproval()) {\n        // More nested logic...\n    }\n}\n```\n\n### The Solution\n\n```php\n// With EventMachine: clear states, explicit transitions, testable behaviors\nMachineDefinition::define(\n    config: [\n        'initial' =\u003e 'pending',\n        'states' =\u003e [\n            'pending' =\u003e [\n                'on' =\u003e [\n                    'APPROVE' =\u003e [\n                        'target' =\u003e 'approved',\n                        'guards' =\u003e [CanApproveGuard::class, NotExpiredGuard::class],\n                    ],\n                ],\n            ],\n            'approved' =\u003e [\n                'entry' =\u003e NotifyCustomerAction::class,\n            ],\n        ],\n    ],\n);\n```\n\n### Key Benefits\n\n| Feature | Description |\n|---------|-------------|\n| **Event Sourced** | Every transition persisted. Full audit trail. Replay history. |\n| **Behaviors** | Guards validate, calculators compute, actions execute. |\n| **Parallel Dispatch** | True parallel execution via Laravel queues. 5s + 2s = 5s, not 7s. |\n| **Testable** | Fake any behavior. Assert states. Verify transitions. |\n| **Type-Safe Context** | Spatie Data powered. Validated. IDE autocompletion. |\n| **Archival** | Compress millions of events. Restore any machine instantly. |\n| **Laravel Native** | Eloquent, DI, Artisan commands. Built for Laravel. |\n\n## Installation\n\n```bash\ncomposer require tarfin-labs/event-machine\n```\n\n```bash\nphp artisan vendor:publish --tag=\"event-machine-migrations\"\nphp artisan migrate\n```\n\n## Support Policy\n\nOnly the **latest major version** (currently v7) receives bug fixes and security patches. All previous versions are end of life. See the [Upgrading Guide](https://eventmachine.dev/getting-started/upgrading) for step-by-step migration from any version.\n\n## Eloquent Integration\n\n```php\nclass Order extends Model\n{\n    use HasMachines;\n\n    protected $casts = [\n        'machine' =\u003e MachineCast::class.':'.OrderMachine::class,\n    ];\n}\n\n// Use it naturally\n$order = Order::create();\n$order-\u003emachine-\u003esend(['type' =\u003e 'SUBMIT']);\n$order-\u003emachine-\u003esend(['type' =\u003e 'APPROVE']);\n\n$order-\u003emachine-\u003estate-\u003ematches('approved'); // true\n$order-\u003emachine-\u003estate-\u003ehistory-\u003ecount();    // 3 events tracked\n```\n\n## Documentation\n\nFor guards, actions, calculators, hierarchical states, parallel dispatch, validation, testing, and more:\n\n**[Read the Documentation →](https://event-machine.tarfin.com)**\n\n## Credits\n\n- [Yunus Emre Deligöz](https://github.com/deligoez)\n- [Fatih Aydın](https://github.com/aydinfatih)\n- [Yunus Emre Nalbant](https://github.com/YunusEmreNalbant)\n- [Faruk Can](https://github.com/frkcn)\n- [Turan Karatuğ](https://github.com/tkaratug)\n- [Yılmaz Demir](https://github.com/yidemir)\n- Maybe you? [Contribute →](../../contributing)\n\n## License\n\nMIT License. See [LICENSE](LICENSE.md) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftarfin-labs%2Fevent-machine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftarfin-labs%2Fevent-machine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftarfin-labs%2Fevent-machine/lists"}