PHP 7.4 in practice – typed properties pitfalls, hydration, PHP 8.0 preview
PHP 7.4 was released in November 2019. After migrating several Magento 2 modules to the new version I have a clear picture. Typed properties genuinely affect the way you write classes – but they also have pitfalls worth knowing. I show what works great, what surprises you, and what migration looks like in practice.
- Published in PHP
Factory Method – Simple Factory, GoF, auto-generated factories in Magento 2
The new operator in production code is a warning sign. A class that directly instantiates other classes is tightly coupled to them – hard to test, hard to extend. Factory Method delegates the responsibility for object creation to dedicated classes. In Magento 2 factories are everywhere – and generated automatically.
- Published in Wzorce projektowe
Message Queue Framework with RabbitMQ – publisher, consumer, DDEV config
Operations like sending emails, syncing with an ERP, or recalculating indexes do not have to block an HTTP request. Magento 2 has a built-in Message Queue Framework that lets you push such tasks to an asynchronous queue. I show how it works with RabbitMQ and how to write your own publisher and consumer.
- Published in Magento / Adobe Commerce
Hash table in PHP – in_array vs isset, SplQueue, SplFixedArray
A PHP array is one of the most-used data types, but few people think about how it works under the hood. A PHP array is actually a hash table – a data structure that allows O(1) element access. I show how it works, what the practical implications are, and where PHP arrays surprise you with their performance characteristics.
- Published in Algorytmy
