Talk in English - US at Longhorn PHP 2026
Track Name:
Elm
Checkout the code: https://github.com/byjg/longhorn-2026-code-support
View Slides: https://github.com/byjg/longhorn-2026-code-support/blob/main/Longhorn%202026%20-%20Component%20PHP%20State%20Machine%20-%20Final%20deck.pdf
Short URL: https://joind.in/talk/c06c4
(QR-Code (opens in new window))
Many business processes begin with a status column and a few if statements. Then exceptions, retries, approvals, and failure paths appear. Before long, the workflow is scattered across controllers, services, queue consumers, scheduled jobs, and database updates, and nobody can say with confidence which transitions are valid or what should happen when something fails.
In this hands-on session, we'll use state machines to make these workflows explicit, predictable, and testable in PHP. Using familiar examples such as orders, payments, withdrawals, onboarding, and identity verification, we'll model each process as a set of states, allowed transitions, guard conditions, and actions rather than relying on loose status strings.
Using a real PHP state machine library, we'll build a workflow live, prevent invalid transitions, centralize the rules that determine what can happen next, and automatically trigger actions when the state changes. We'll also test the workflow logic independently of controllers and infrastructure.
We'll then look at how a state machine fits into a real PHP application, including where the workflow logic should live and how the rest of the application should interact with it.
You'll leave knowing how to recognize when a growing collection of conditionals should become an explicit workflow model and how to implement that model cleanly and testably in PHP.
Comments
Please login to leave a comment
The concepts were good, about using state machines instead of too many if statements and poor code architecture. The principles were useful for abstracting logic and building more robust code. It was hard to follow along because the slides weren't shared out before the talk. The talk was limited to single transactions with a financial focus, which is a limited use case, would have been good to make it more generic or other examples.
Great pacing, conceptual overview, ecosystem overview, use cases, examples & reference implementations. Checked all the boxes to put this into your toolbox immediately.
The concepts were good, but it was hard to follow where the code samples "lived" as you worked through it. I think everyone should be using state machines, so keep telling people about it.
I really liked the code samples, they were very clear and easy to follow. After listening to this talk, it wasn't hard to imagine what my state machine might be for my work app.
Found some great solutions here. The subject matter was excellent. My major portion of frustration was understanding the verbal portion of the presentation. Thank you for the start!