Value Objects with PHP 8.1

PHP has introduced a number of new features that allow you to write awesome Value Objects with PHP 8.1. In this post you will learn about each feature and how to put them all together.

Back in the dark ages of 2016, shortly after PHP 7.0 was released, I wrote a Missing In PHP 7 blog post series. Four of the five posts describe functionality that is no longer missing, as of PHP 8.1 or earlier. Missing in PHP7: Value objects is one of those posts.

You can find a quick recap on what a Value Object is, and why you would want to use them, in Missing in PHP7: Value objects.

New features/syntax since PHP 7.0

Value Object using PHP 8.1 features

Bonus

Other new PHP features that I am excited about:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.