- Is yohang/finite a Laravel package?
- No. yohang/finite is a framework-agnostic PHP finite state machine, not a Laravel-specific package. It gives you the graph primitive of states, transitions, guards and callbacks, but deliberately leaves persistence, authorization and transport to your application. In Laravel you use it inside domain services, form requests, jobs or console commands rather than expecting automatic Eloquent integration.
- How do I install yohang/finite in a Laravel application?
- Install it with a single Composer require command. There is no service provider, facade, config stub or published migration, so first value requires a small in-house adapter. Realistically you should budget one to three engineering days for a working adapter, a factory or container binding, persistence mapping and tests.
- Which Laravel and PHP versions does yohang/finite support?
- The library is compatible with PHP 8.x and does not impose framework constraints, so it fits any Laravel version that supports your PHP runtime. Because it is framework-agnostic, there is no Laravel version matrix to fight against. Check the package composer.json before upgrading PHP to confirm the exact constraint.
- How do I persist a yohang/finite state machine on an Eloquent model?
- Persistence is not built in, so you own the mapping between the machine state and a database column or history table. A common approach is a transition service that runs the machine, writes the new status inside a transaction and uses row-level locking where needed. You also need to decide who is allowed to write the status column directly and add a model guard or database constraint to reject unapproved writes.
- How do I listen to transition events in Laravel with yohang/finite?
- yohang/finite ships an optional Symfony EventDispatcher bridge, which does not map cleanly onto Laravel's dispatcher. Expect to write a thin translation layer that forwards transition events into Laravel listeners, broadcasting or queues. If downstream systems need reliable events across queue retries, design that reliability into your adapter rather than assuming the library provides it.
- Can I unit test yohang/finite state machine rules with PHPUnit?
- Yes, and this is where most of the value is. The in-memory machine definition is cheap to construct and easy to test, so transition rules become fast pure unit tests instead of feature tests through HTTP. That suits codebases where workflow rules change independently of the HTTP layer.
- Does yohang/finite handle concurrency control and database locking?
- No. Concurrency control, audit history, transition authorization and multi-machine-per-entity support are not solved by the library and become internal build items. If you need pessimistic locks, optimistic version columns or queued transitions, implement them in your transition service. The machine itself only describes the graph and runs the hooks you define.
- What are the alternatives to yohang/finite for Laravel workflows?
- Credible alternatives include spatie/laravel-model-states, which is more idiomatic for Eloquent coupling, and Symfony Workflow, which offers heavier graph semantics and richer tooling. Choosing yohang/finite means choosing minimalism and owning the integration glue yourself. Evaluate based on whether you want an Eloquent-first package or a small framework-agnostic primitive.
- Is yohang/finite actively maintained and safe for production?
- The package is small, mature and MIT-licensed, with meaningful adoption of roughly 1.3k stars. A December 2025 release suggests it is still alive, but it appears to be maintained by a very small team. Verify release cadence and issue responsiveness before committing, since the primary risk is dependency health rather than code quality.
- Can I run multiple workflows per entity with yohang/finite?
- Multiple machines per entity are not solved out of the box, so you would construct separate machine instances and manage that mapping yourself. The library deliberately leaves that orchestration to the application. If several workflows are likely, confirm your team accepts owning that glue code indefinitely before standardizing on finite.