Magento 2 performance is a broad topic, but the high-impact improvements follow a clear priority order. OPcache configuration is free and immediate. Redis correctly configured reduces PHP cycles. N+1 queries are the single biggest source of slowness in custom code. Blackfire makes the invisible visible. I show a prioritised approach with concrete configurations and code examples.
TypeScript is to JavaScript what strict_types + PHPStan is to PHP – it adds a type system on top of a dynamically typed language and catches errors before runtime. For a PHP developer the concepts are familiar: interfaces, generics, union types. I show the most important TypeScript features from the perspective of someone who thinks in typed PHP daily.
PHP 8.2 was officially released on 8 December 2022. A month of using readonly classes in new modules and patching dynamic properties in older code gives a clear practical picture. I show what readonly classes look like in real Magento 2 code, the most common dynamic property violations and how to fix them with Rector, and a migration checklist for upgrading existing projects.
Template Method defines the skeleton of an algorithm in a base class and lets subclasses fill in specific steps. It is the backbone of inheritance-based extensibility – and one of the most widely used patterns in frameworks like Magento 2, Symfony and Laravel. I show the classic GoF implementation, the difference between abstract steps and hooks, and a comparison with Strategy.
Multi Source Inventory replaced the old single-stock Magento inventory system. MSI introduces Sources (physical locations), Stocks (virtual aggregations), and Source Selection Algorithms (how to fulfil orders). Most shops use only default configurations, but once you have multiple warehouses or need custom fulfilment logic, MSI requires deep understanding. I show the architecture and how to write a custom SSA.
Quicksort is the most widely used sorting algorithm in practice – it is the basis of PHP’s built-in sort(), most standard library implementations, and many database engines. I show the classic recursive implementation, the three-way partition variant for arrays with many duplicates, and benchmark it against PHP’s native sort() and usort() to see when writing your own makes any sense at all.
Building a custom payment method in Magento 2 is one of the more complex integrations you can do on the platform. It touches frontend JavaScript, backend PHP, REST API configuration, and security requirements. I walk through the complete implementation – authorize, capture, refund, the JS renderer for checkout, and PCI DSS considerations.
PHP 8.2 arrives in November 2022 and its headline features are more conservative than 8.0 or 8.1, but each one plugs a real gap in the type system. Readonly classes eliminate boilerplate in immutable DTOs. DNF types allow complex type expressions that were impossible before. Deprecating dynamic properties starts enforcing something good OOP practice demanded for years.
After covering all 23 GoF patterns individually, time to see where they actually live inside Magento 2. The platform is a textbook example of design patterns applied at scale – DI, plugins, observers, repositories, factories all map directly to specific GoF patterns. This post is a guided tour of patterns hiding in plain sight in Magento’s architecture.
Command and Chain of Responsibility are two behavioural patterns that both deal with processing requests – but from different angles. Command encapsulates a request as an object, enabling undo, queuing, and logging. Chain of Responsibility passes the request along a handler chain until one processes it. I show GoF implementations and their natural fit in Magento 2.
