What’s new in PHP 8.3

TL;DR: PHP 8.3 will be released on November 23, 2023. It will add typed class constants, a new helper function json_validate to check json payloads and some minor improvements for Randomizer class, reading ini configuration and more. The PHP team will release the new minor version of PHP to the end of this month. The … read more …

Laminas Framework Series: Middleware in Mezzio and MVC

The second post of “Laminas Framework Series” compares Mezzio and the framework based on “Model-View-Controller” (short: MVC). The Laminas Framework is for its own is relatively new, but since it is an entire fork and a continuation of the Zend Framework, it has very deep roots in the enterprise software development with PHP. Mezzio – … read more …

PHP 8: Making the Choice Between “switch” and “match”

In the constantly changing landscape of PHP, version 8 brought with it an innovative feature: the match expression in contrast to switch. Many see it as a streamlined and more effective counterpart to the traditional switch. Let’s explore their distinctions. The traditional switch goes something like this: With PHP 8, the equivalent match looks far … read more …

Towards Powerful PHP Applications: WeakMaps and Their Practical Usage

PHP introduces WeakMap datastructure with version 8.0. This new data structures is capable of containing objects while simultaneously enabling them to be cleared via garbage collection once not needed anymore. WeakMap is a evolution of weak references added with PHP 7.4 and enables the development of collections of references that can be subjected to garbage … read more …

How and When to Use PHP’s Pure Intersection Types

In this publication of my PHP related blog series, I want to address Pure Intersection Types in PHP. In the previous blogs of the series, I addressed different features added to PHP with PHP 8 and PHP 8.1. The first blog was about readonly properties, the second one focused on Enums and the third and … read more …

About Mocking in Unit Tests

Recently at SCAYLE, I wrote a Laravel service that inserts data using Eloquent into a table like this: For people not familiar with Laravel/Eloquent: The HelloWorld model mirrors the database structure and the save method persists data into the database table. So far, so good. Like for any good and responsible project, I wrote unit … read more …

When to use Traits in PHP

Traits were introduced to PHP in version 5.4. While classes were introduced in version 4, class inheritance was – as in Java – limited to single inheritance only from the very beginning. Class Inheritance: The Good, The Bad, The Ugly Class Inheritance is a central concept in object oriented programming and exists in every programming … read more …

Scalable System Design: Design a Contact Tracing System

In this post, I want to address scalable system design and how to grow a system while it’s user base grows. Because talking only about the theory can become boring very quickly, I want to discuss this topic on a practical example. Before I start with the design itself, keep in mind that there is … read more …