~/talk

PHP, Value Objects and You 🫵

Talkat PHP UK Conference 2026 · on Friday, 2026-02-20· [php]
slides:none on file

Claims that value objects make PHP code more expressive and less buggy with concrete patterns: prefer the constructor and immutability over mutable setters, prefer immutable instances that spawn new instances for changes, prefer self‑validating creation and named static factories for conversions (RGB↔HEX↔HSV), and prefer aggregating objects so color interpolation lives on a color range instead of a ColorUtils class which can be removed. Avoid mocking pure data, avoid value‑object interfaces/abstracts, consider mapping libraries like Valenor and beware DateTime's extra complexity.

AI-written summary · about

  1. 0:00Introduction
  2. 1:03Why value objects talk
  3. 3:30Value objects and modeling
  4. 5:40Real-world value objects
  5. 7:50Immutable and final value objects
  6. 9:16Validating value objects
  7. 11:21Converting value object representations
  8. 12:47Combining value objects
  9. 13:08Code smells for value objects
  10. 14:30Refactoring utility classes
  11. 16:58Value objects operators and methods
  12. 19:45Value objects anti-patterns
  13. 23:10Bounded contexts
  14. 24:58Naming conventions
  15. 25:41Avoiding fromArray and toArray
  16. 27:07Mocking value objects in tests
  17. 28:11Principles for value objects
  18. 29:15Bending value object rules
  19. 30:38Q&A
  20. 32:51Q&A
  21. 33:37Q&A
~/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.