{"id":2848,"date":"2022-01-30T13:58:58","date_gmt":"2022-01-30T12:58:58","guid":{"rendered":"https:\/\/www.entropywins.wtf\/blog\/?p=2848"},"modified":"2022-01-30T13:59:53","modified_gmt":"2022-01-30T12:59:53","slug":"value-objects-with-php-8-1","status":"publish","type":"post","link":"https:\/\/www.entropywins.wtf\/blog\/2022\/01\/30\/value-objects-with-php-8-1\/","title":{"rendered":"Value Objects with PHP 8.1"},"content":{"rendered":"<p>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.<\/p>\n<p>Back in the dark ages of 2016, shortly after PHP 7.0 was released, I wrote a <a href=\"https:\/\/www.entropywins.wtf\/blog\/2016\/01\/30\/missing-in-php7\/\">Missing In PHP 7<\/a> blog post series. Four of the five posts describe functionality that is no longer missing, as of PHP 8.1 or earlier. <a href=\"https:\/\/www.entropywins.wtf\/blog\/2016\/02\/03\/missing-in-php7-value-objects\/\">Missing in PHP7: Value objects<\/a> is one of those posts.<\/p>\n<p>You can find a quick recap on what a Value Object is, and why you would want to use them, in <a href=\"https:\/\/www.entropywins.wtf\/blog\/2016\/02\/03\/missing-in-php7-value-objects\/\">Missing in PHP7: Value objects<\/a>.<\/p>\n<h2>New features\/syntax since PHP 7.0<\/h2>\n<ul>\n<li>PHP 7.4 brought us Typed Properties<\/li>\n<li><a href=\"https:\/\/www.php.net\/releases\/8.0\/en.php\">PHP 8.0<\/a> brought us <a href=\"https:\/\/wiki.php.net\/rfc\/named_params\">Named Arguments<\/a> and <a href=\"https:\/\/www.php.net\/manual\/en\/language.oop5.decon.php#language.oop5.decon.constructor.promotion\">Constructor Property Promotion<\/a><\/li>\n<li><a href=\"https:\/\/www.php.net\/releases\/8.1\/en.php\">PHP 8.1<\/a> brought us <a href=\"https:\/\/www.php.net\/manual\/en\/language.oop5.properties.php#language.oop5.properties.readonly-properties\">Readonly Properties<\/a> (and <a href=\"https:\/\/wiki.php.net\/rfc\/new_in_initializers\">New in Initializers<\/a>)<\/li>\n<\/ul>\n<h2>Value Object using PHP 8.1 features<\/h2>\n<pre class=\"\">class ContactRequest {\n   public function __construct(\n      public readonly string $firstName = 'nyan',\n      public readonly string $lastName = 'cat',\n      public readonly string $emailAddress = 'something',\n   ) {\n   }\n}\n\n$request = new ContactRequest(firstName: 'foo', lastName: 'bar', emailAddress: 'baz');\n\n$firstName = $request->firstName;\n$request->lastName = 'hax'; \/\/ Fails<\/pre>\n<h2>Bonus<\/h2>\n<p>Other new PHP features that I am excited about:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.php.net\/manual\/en\/language.types.declarations.php#language.types.declarations.composite.intersection\">Pure Intersection Types<\/a> (PHP 8.1)<\/li>\n<li><a href=\"https:\/\/www.php.net\/manual\/en\/functions.first_class_callable_syntax.php\">First-class Callable Syntax<\/a> (PHP 8.1)<\/li>\n<li><a href=\"https:\/\/php.watch\/versions\/8.0\/mixed-type\">Mixed return type<\/a> and <a href=\"https:\/\/www.php.net\/manual\/en\/language.types.declarations.php#language.types.declarations.union\">Union types<\/a> (PHP 8.0), typically just for legacy code though<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1613\" data-permalink=\"https:\/\/www.entropywins.wtf\/blog\/2016\/02\/03\/missing-in-php7-value-objects\/i-will-always-favor-value-objects\/\" data-orig-file=\"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2016\/02\/i-will-always-favor-value-objects.png\" data-orig-size=\"600,300\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"i-will-always-favor-value-objects\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2016\/02\/i-will-always-favor-value-objects.png\" class=\"alignnone size-full wp-image-1613\" src=\"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2016\/02\/i-will-always-favor-value-objects.png\" alt=\"\" width=\"600\" height=\"300\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>PHP has introduced a number of new features that allow you to write awesome Value Objects with PHP 8.1. In&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[7],"tags":[328,405,179,195,464,197,316,404],"class_list":["post-2848","post","type-post","status-publish","format-standard","hentry","category-programming","tag-clean-code","tag-domain-driven-design","tag-oop","tag-php","tag-php8","tag-planet-wikimedia","tag-software-design","tag-value-objects"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Value Objects with PHP 8.1 - Blog of Jeroen De Dauw<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.entropywins.wtf\/blog\/2022\/01\/30\/value-objects-with-php-8-1\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Value Objects with PHP 8.1 - Blog of Jeroen De Dauw\" \/>\n<meta property=\"og:description\" content=\"PHP has introduced a number of new features that allow you to write awesome Value Objects with PHP 8.1. In&hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.entropywins.wtf\/blog\/2022\/01\/30\/value-objects-with-php-8-1\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog of Jeroen De Dauw\" \/>\n<meta property=\"article:published_time\" content=\"2022-01-30T12:58:58+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-01-30T12:59:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2016\/02\/i-will-always-favor-value-objects.png\" \/>\n<meta name=\"author\" content=\"Jeroen\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/JeroenDeDauw\" \/>\n<meta name=\"twitter:site\" content=\"@JeroenDeDauw\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeroen\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2022\\\/01\\\/30\\\/value-objects-with-php-8-1\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2022\\\/01\\\/30\\\/value-objects-with-php-8-1\\\/\"},\"author\":{\"name\":\"Jeroen\",\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/#\\\/schema\\\/person\\\/4e2ef14f2ca7dc3a0ac137d1692b66b7\"},\"headline\":\"Value Objects with PHP 8.1\",\"datePublished\":\"2022-01-30T12:58:58+00:00\",\"dateModified\":\"2022-01-30T12:59:53+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2022\\\/01\\\/30\\\/value-objects-with-php-8-1\\\/\"},\"wordCount\":175,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/#\\\/schema\\\/person\\\/4e2ef14f2ca7dc3a0ac137d1692b66b7\"},\"image\":{\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2022\\\/01\\\/30\\\/value-objects-with-php-8-1\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/02\\\/i-will-always-favor-value-objects.png\",\"keywords\":[\"Clean Code\",\"Domain Driven Design\",\"OOP\",\"PHP\",\"PHP8\",\"Planet Wikimedia\",\"Software design\",\"Value objects\"],\"articleSection\":[\"Programming\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2022\\\/01\\\/30\\\/value-objects-with-php-8-1\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2022\\\/01\\\/30\\\/value-objects-with-php-8-1\\\/\",\"url\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2022\\\/01\\\/30\\\/value-objects-with-php-8-1\\\/\",\"name\":\"Value Objects with PHP 8.1 - Blog of Jeroen De Dauw\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2022\\\/01\\\/30\\\/value-objects-with-php-8-1\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2022\\\/01\\\/30\\\/value-objects-with-php-8-1\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/02\\\/i-will-always-favor-value-objects.png\",\"datePublished\":\"2022-01-30T12:58:58+00:00\",\"dateModified\":\"2022-01-30T12:59:53+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2022\\\/01\\\/30\\\/value-objects-with-php-8-1\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2022\\\/01\\\/30\\\/value-objects-with-php-8-1\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2022\\\/01\\\/30\\\/value-objects-with-php-8-1\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/02\\\/i-will-always-favor-value-objects.png\",\"contentUrl\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/02\\\/i-will-always-favor-value-objects.png\",\"width\":600,\"height\":300},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2022\\\/01\\\/30\\\/value-objects-with-php-8-1\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Value Objects with PHP 8.1\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/\",\"name\":\"Entropy Wins\",\"description\":\"A blog on Software Architecture, Design and Craftsmanship\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/#\\\/schema\\\/person\\\/4e2ef14f2ca7dc3a0ac137d1692b66b7\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/#\\\/schema\\\/person\\\/4e2ef14f2ca7dc3a0ac137d1692b66b7\",\"name\":\"Jeroen\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d62e6b5b8e332335cf17854fac850d9c70ba367c4692872613c3110ebd4e009b?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d62e6b5b8e332335cf17854fac850d9c70ba367c4692872613c3110ebd4e009b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d62e6b5b8e332335cf17854fac850d9c70ba367c4692872613c3110ebd4e009b?s=96&d=mm&r=g\",\"caption\":\"Jeroen\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d62e6b5b8e332335cf17854fac850d9c70ba367c4692872613c3110ebd4e009b?s=96&d=mm&r=g\"},\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/jeroendedauw\\\/\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/JeroenDeDauw\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Value Objects with PHP 8.1 - Blog of Jeroen De Dauw","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.entropywins.wtf\/blog\/2022\/01\/30\/value-objects-with-php-8-1\/","og_locale":"en_US","og_type":"article","og_title":"Value Objects with PHP 8.1 - Blog of Jeroen De Dauw","og_description":"PHP has introduced a number of new features that allow you to write awesome Value Objects with PHP 8.1. In&hellip;","og_url":"https:\/\/www.entropywins.wtf\/blog\/2022\/01\/30\/value-objects-with-php-8-1\/","og_site_name":"Blog of Jeroen De Dauw","article_published_time":"2022-01-30T12:58:58+00:00","article_modified_time":"2022-01-30T12:59:53+00:00","og_image":[{"url":"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2016\/02\/i-will-always-favor-value-objects.png","type":"","width":"","height":""}],"author":"Jeroen","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/JeroenDeDauw","twitter_site":"@JeroenDeDauw","twitter_misc":{"Written by":"Jeroen","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.entropywins.wtf\/blog\/2022\/01\/30\/value-objects-with-php-8-1\/#article","isPartOf":{"@id":"https:\/\/www.entropywins.wtf\/blog\/2022\/01\/30\/value-objects-with-php-8-1\/"},"author":{"name":"Jeroen","@id":"https:\/\/www.entropywins.wtf\/blog\/#\/schema\/person\/4e2ef14f2ca7dc3a0ac137d1692b66b7"},"headline":"Value Objects with PHP 8.1","datePublished":"2022-01-30T12:58:58+00:00","dateModified":"2022-01-30T12:59:53+00:00","mainEntityOfPage":{"@id":"https:\/\/www.entropywins.wtf\/blog\/2022\/01\/30\/value-objects-with-php-8-1\/"},"wordCount":175,"commentCount":0,"publisher":{"@id":"https:\/\/www.entropywins.wtf\/blog\/#\/schema\/person\/4e2ef14f2ca7dc3a0ac137d1692b66b7"},"image":{"@id":"https:\/\/www.entropywins.wtf\/blog\/2022\/01\/30\/value-objects-with-php-8-1\/#primaryimage"},"thumbnailUrl":"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2016\/02\/i-will-always-favor-value-objects.png","keywords":["Clean Code","Domain Driven Design","OOP","PHP","PHP8","Planet Wikimedia","Software design","Value objects"],"articleSection":["Programming"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.entropywins.wtf\/blog\/2022\/01\/30\/value-objects-with-php-8-1\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.entropywins.wtf\/blog\/2022\/01\/30\/value-objects-with-php-8-1\/","url":"https:\/\/www.entropywins.wtf\/blog\/2022\/01\/30\/value-objects-with-php-8-1\/","name":"Value Objects with PHP 8.1 - Blog of Jeroen De Dauw","isPartOf":{"@id":"https:\/\/www.entropywins.wtf\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.entropywins.wtf\/blog\/2022\/01\/30\/value-objects-with-php-8-1\/#primaryimage"},"image":{"@id":"https:\/\/www.entropywins.wtf\/blog\/2022\/01\/30\/value-objects-with-php-8-1\/#primaryimage"},"thumbnailUrl":"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2016\/02\/i-will-always-favor-value-objects.png","datePublished":"2022-01-30T12:58:58+00:00","dateModified":"2022-01-30T12:59:53+00:00","breadcrumb":{"@id":"https:\/\/www.entropywins.wtf\/blog\/2022\/01\/30\/value-objects-with-php-8-1\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.entropywins.wtf\/blog\/2022\/01\/30\/value-objects-with-php-8-1\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.entropywins.wtf\/blog\/2022\/01\/30\/value-objects-with-php-8-1\/#primaryimage","url":"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2016\/02\/i-will-always-favor-value-objects.png","contentUrl":"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2016\/02\/i-will-always-favor-value-objects.png","width":600,"height":300},{"@type":"BreadcrumbList","@id":"https:\/\/www.entropywins.wtf\/blog\/2022\/01\/30\/value-objects-with-php-8-1\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.entropywins.wtf\/blog\/"},{"@type":"ListItem","position":2,"name":"Value Objects with PHP 8.1"}]},{"@type":"WebSite","@id":"https:\/\/www.entropywins.wtf\/blog\/#website","url":"https:\/\/www.entropywins.wtf\/blog\/","name":"Entropy Wins","description":"A blog on Software Architecture, Design and Craftsmanship","publisher":{"@id":"https:\/\/www.entropywins.wtf\/blog\/#\/schema\/person\/4e2ef14f2ca7dc3a0ac137d1692b66b7"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.entropywins.wtf\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.entropywins.wtf\/blog\/#\/schema\/person\/4e2ef14f2ca7dc3a0ac137d1692b66b7","name":"Jeroen","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/d62e6b5b8e332335cf17854fac850d9c70ba367c4692872613c3110ebd4e009b?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/d62e6b5b8e332335cf17854fac850d9c70ba367c4692872613c3110ebd4e009b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d62e6b5b8e332335cf17854fac850d9c70ba367c4692872613c3110ebd4e009b?s=96&d=mm&r=g","caption":"Jeroen"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/d62e6b5b8e332335cf17854fac850d9c70ba367c4692872613c3110ebd4e009b?s=96&d=mm&r=g"},"sameAs":["https:\/\/www.linkedin.com\/in\/jeroendedauw\/","https:\/\/x.com\/https:\/\/twitter.com\/JeroenDeDauw"]}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p74TBF-JW","jetpack-related-posts":[{"id":1548,"url":"https:\/\/www.entropywins.wtf\/blog\/2016\/01\/30\/missing-in-php7\/","url_meta":{"origin":2848,"position":0},"title":"Missing in PHP7","author":"Jeroen","date":"2016-01-30","format":false,"excerpt":"I've decided to start a series of short blog posts on how PHP gets in the way of\u00a0creating of well designed applications, with a focus on missing features. The language flamewar PHP is one of those languages that people love to hate. Its standard library is widely inconsistent, and its\u2026","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/www.entropywins.wtf\/blog\/category\/programming\/"},"img":{"alt_text":"PHP7","src":"https:\/\/i0.wp.com\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2016\/01\/PHP7.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":1577,"url":"https:\/\/www.entropywins.wtf\/blog\/2016\/01\/30\/missing-in-php7-function-references\/","url_meta":{"origin":2848,"position":1},"title":"Missing in PHP7: function references","author":"Jeroen","date":"2016-01-30","format":false,"excerpt":"This is the first post in my Missing in PHP7 series. Over time, PHP has improved its capabilities with regards to functions.\u00a0As of PHP 5.3 you can create anonymous functions and as of 5.4 you can use the callable type hint. However referencing a function still requires using a string.\u2026","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/www.entropywins.wtf\/blog\/category\/programming\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1629,"url":"https:\/\/www.entropywins.wtf\/blog\/2016\/02\/22\/missing-in-php7-collections\/","url_meta":{"origin":2848,"position":2},"title":"Missing in PHP7: Collections","author":"Jeroen","date":"2016-02-22","format":false,"excerpt":"This is the fourth post in my Missing in PHP7 series. The previous one is about Value Objects. In this post I'll outline some problems PHP has with regards to collections, the implications of those problems, and a few mitigation strategies. PHP arrays PHPs main collection type is the associative\u2026","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/www.entropywins.wtf\/blog\/category\/programming\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2016\/02\/dfp.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2016\/02\/dfp.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2016\/02\/dfp.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2016\/02\/dfp.jpg?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":2381,"url":"https:\/\/www.entropywins.wtf\/blog\/2018\/10\/28\/php-typed-properties\/","url_meta":{"origin":2848,"position":3},"title":"PHP Typed Properties","author":"Jeroen","date":"2018-10-28","format":false,"excerpt":"Lately there has been a lot of hype around the typed properties that PHP 7.4 will bring. In this post I outline why typed properties are not as big of a game changer as some people seem to think and how they can lead to shitty code. I start by\u2026","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/www.entropywins.wtf\/blog\/category\/programming\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2018\/10\/php-1.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2018\/10\/php-1.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2018\/10\/php-1.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2018\/10\/php-1.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2018\/10\/php-1.png?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2018\/10\/php-1.png?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":1607,"url":"https:\/\/www.entropywins.wtf\/blog\/2016\/02\/03\/missing-in-php7-value-objects\/","url_meta":{"origin":2848,"position":4},"title":"Missing in PHP7: Value objects","author":"Jeroen","date":"2016-02-03","format":false,"excerpt":"This is the third post in my Missing in PHP7 series. The previous one is about\u00a0named parameters. A Value Object does not have an identity, which means that if you have two of them with the same data, they are considered equal (take two latitude, longitude pairs for instance). Generally\u2026","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/www.entropywins.wtf\/blog\/category\/programming\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2016\/02\/i-will-always-favor-value-objects.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2016\/02\/i-will-always-favor-value-objects.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2016\/02\/i-will-always-favor-value-objects.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":1898,"url":"https:\/\/www.entropywins.wtf\/blog\/2016\/12\/02\/php-7-1-is-awesome\/","url_meta":{"origin":2848,"position":5},"title":"PHP 7.1 is awesome","author":"Jeroen","date":"2016-12-02","format":false,"excerpt":"PHP 7.1 has been released, bringing some features I was eagerly anticipating and some surprises that had gone under my radar. New iterable pseudo-type This is the feature I'm most exited about, perhaps because I had no clue it was in the works. In short, iterable allows for type hinting\u2026","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/www.entropywins.wtf\/blog\/category\/programming\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.entropywins.wtf\/blog\/wp-json\/wp\/v2\/posts\/2848","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.entropywins.wtf\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.entropywins.wtf\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.entropywins.wtf\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.entropywins.wtf\/blog\/wp-json\/wp\/v2\/comments?post=2848"}],"version-history":[{"count":3,"href":"https:\/\/www.entropywins.wtf\/blog\/wp-json\/wp\/v2\/posts\/2848\/revisions"}],"predecessor-version":[{"id":2851,"href":"https:\/\/www.entropywins.wtf\/blog\/wp-json\/wp\/v2\/posts\/2848\/revisions\/2851"}],"wp:attachment":[{"href":"https:\/\/www.entropywins.wtf\/blog\/wp-json\/wp\/v2\/media?parent=2848"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.entropywins.wtf\/blog\/wp-json\/wp\/v2\/categories?post=2848"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.entropywins.wtf\/blog\/wp-json\/wp\/v2\/tags?post=2848"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}