Chain of Responsibility passes a request along a chain of handlers. Each handler decides whether to process it or pass it on. The pattern is perfect for multi-step validation, middleware pipelines, and request processing where the set of handlers needs to change without modifying callers. I build a validator chain in PHP and show how to configure handler order through Magento 2 di.xml.

(more…)

Redis in Magento 2 is not a single thing – it serves three distinct roles that should ideally run as separate instances with different configurations. Object cache, Full Page Cache, and session storage have very different access patterns and eviction requirements. I show how to configure each, why separate instances matter, and how to monitor what is happening.

(more…)

Dynamic programming is one of those techniques that sounds intimidating but is built on one simple idea: remember results you have already computed so you do not compute them again. Memoization, the knapsack problem, Longest Common Subsequence – I implement them all in PHP and show a reusable memoize decorator that works with any callable.

(more…)

PHP 8.1 is due in November 2021 and brings the most significant type system additions since PHP 7.0. Enums solve a problem we have been working around with class constants for years. Readonly properties close the final gap in immutable value objects. Intersection types complete the union types from PHP 8.0. Fibers introduce cooperative multitasking. I go through each with practical examples.

(more…)

TOP