Service Contracts – Data Interfaces and Repository Pattern in Magento 2
Directly using Magento 2 models in your own code is a tempting shortcut. The model is right there, it has the method you need, it works. The problem appears when Magento is updated and the internal implementation changes. Service Contracts are Magento’s answer – a stable, public API separated from the implementation.
- Published in Magento / Adobe Commerce
PHP 7.3 – JSON_THROW_ON_ERROR, flexible Heredoc, array_key_first/last
PHP 7.3 was officially released in December 2018. Not a revolution, but a few changes have a real impact on everyday code – especially working with JSON, more flexible Heredoc syntax, and a handful of new array functions.
- Published in PHP
DDEV – local Magento 2 in 10 minutes, comparison with XAMPP
For years, setting up a local Magento 2 environment was a ritual of pain: XAMPP with manual vhost configuration, fighting PHP versions, unreproducible “works on my machine” problems. DDEV solves this elegantly – Docker underneath, simple YAML configuration on top.
- Published in Środowiska
Sorting in PHP – bubble sort, merge sort, usort() and the spaceship operator <=>
Sorting is a topic most of us “tick off” at university and only return to during job interviews. Yet understanding how sorting algorithms work helps make better decisions in everyday PHP and database work. I walk through a few classic approaches, implement them in PHP, and show where this has real practical relevance.
- Published in Algorytmy
