Magento 2 Command pattern with Message Queue combines two mechanisms: Command encapsulates an operation as an object, and Message Queue executes it asynchronously. In practice: instead of sending an email synchronously in an HTTP request (blocking the response), you push a message to a queue and a consumer handles it in the background. I show how to implement this using order notifications as an example.

(more…)

PHP 8.4 has been available since November 2024. It brings property hooks – a native implementation of getters and setters without boilerplate, asymmetric property visibility (public private(set)), new array functions and deprecation of functions untouched since PHP 4. This evolution lets you write more concise code without giving up encapsulation.

(more…)

Xdebug 3 changed the configuration model compared to version 2 – a single xdebug.mode directive replaces a dozen settings. Combined with DDEV, setting up debugging for Magento 2 is now significantly simpler than it was three years ago. I show how to run the step debugger in PHPStorm and VS Code, including debugging HTTP requests, CLI commands and unit tests.

(more…)

Magento 2 has a built-in Service Contracts system based on interfaces and Data Interfaces. Instead of injecting models directly, you inject Repository and Data Interface interfaces. This is not just good practice – it is the only way to make a module work stably after updates and be compatible with other modules. I show how to correctly use Service Contracts using the product catalogue as an example.

(more…)

TOP