~/talk

State Machines

Talkat Laracon US 2023 · 2023-07-19..07-20· [php, software-architecture]
links:none on file
slides:none on file

Shows a concrete Laravel implementation: add a status column to invoices, map statuses to classes (Draft, Open, Paid, Uncollectible, Void) that implement an InvoiceState interface, and move finalize/pay/void/cancel logic into those classes. Controllers shrink to calls like $invoice->state()->finalize() and mail notifications run from the state methods (different emails when Uncollectible→Paid). The pattern replaces scattered conditionals, uses a base state for defaults, and demonstrably simplifies adding new transitions.

AI-written summary · about

  1. 0:00Intro
  2. 2:48The Problem
  3. 9:19State Machine Definition
  4. 11:52State Machine Context
  5. 14:25State Pattern
  6. 15:42Tracking State
  7. 19:42Extracting State
  8. 20:58Using State
  9. 22:12Using State in Controllers
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.