Imagine, if you will, a world where you're able to define a tailor-made type for domain objects that is always valid, type-safe, immutable, and easy to test. No more email addresses passed around as plain strings, nor associative arrays being passed around with potentially-undefined keys and unpredictable types.
In this session, we'll dive deep into PHP Value Objects: where are they useful, how do we write (and test!) them, and how do we ensure that the data they encapsulate is valid? Attendees will leave with a better understanding of domain modeling, Value Objects, and immutability.
Warning: once you start using proper value objects, you may never be able to go back to using anything else!
- The Beauty of PHP Value Objects - Blog post that serves as the foundation for this talk
- Value Objects in PHP 8 - A three-part series by Christian Nastasi that goes in-depth with value objects
- Eloquent: Mutators and Casting - Laravel documentation mutators and casting of properties
- Value Object — Article by Martin Fowler describing value objects
- Writing Value Objects in PHP — Great article by Ian Rodrigues describing the inner-workings of value objects
- Primitive Obsession - Refactoring-focused post discussing developers' desire to reduce everything to primitives
- Cascadia PHP 2024 — October 25, 2024 (PDF, joind.in)