PHP / Magento Dev Blog

  • Publikacje
  • O autorze
  • Kontakt

PHP typing in 7.x, strict_types, PHPStan, preparing for PHP 7.4

  • 0
Henryk Tews
Tuesday, 11 June 2019 / Published in PHP

PHP’s type system evolved gradually from 5.x. PHP 7.x strengthened it significantly – parameter typing, return types, nullable types, and union types on the horizon. PHP 7.4 adds typed properties. A good moment to summarise the state of typing and show best practices worth adopting today.

(more…)

XAMPP vs DDEV vs Warden – full comparison table

  • 0
Henryk Tews
Tuesday, 14 May 2019 / Published in Środowiska

Every PHP developer eventually faces the question: how to set up a local environment? For years XAMPP was the default answer. Today we have far more options – and far more reasons to move away from XAMPP to Docker-based tools. I compare three popular approaches from the perspective of working with PHP and Magento 2.

(more…)

Binary search – O(log n) vs O(n) with comparison table

  • 0
Henryk Tews
Tuesday, 09 April 2019 / Published in Algorytmy

Linear search always works. You go through every element one by one and eventually find what you are looking for. The problem appears with 100,000 elements when you do this in a loop. Binary search solves that problem elegantly – but only if the data is sorted.

(more…)

Observer pattern in PHP and the Magento 2 event system

  • 0
Henryk Tews
Tuesday, 19 March 2019 / Published in Wzorce projektowe

Observer is one of the most commonly used patterns in object-oriented programming, and in the Magento 2 ecosystem it is built into the core of the platform. If you have ever written an event observer in Magento, you have used this pattern – often without realising it.

(more…)

Service Contracts – Data Interfaces and Repository Pattern in Magento 2

  • 0
Henryk Tews
Tuesday, 12 February 2019 / Published 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.

(more…)

PHP 7.3 – JSON_THROW_ON_ERROR, flexible Heredoc, array_key_first/last

  • 0
Henryk Tews
Tuesday, 08 January 2019 / Published in PHP

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.

(more…)

DDEV – local Magento 2 in 10 minutes, comparison with XAMPP

  • 0
Henryk Tews
Tuesday, 11 December 2018 / Published in Środowiska

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.

(more…)

Sorting in PHP – bubble sort, merge sort, usort() and the spaceship operator <=>

  • 0
Henryk Tews
Tuesday, 13 November 2018 / Published in Algorytmy

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.

(more…)

Strategy pattern in PHP – and how Magento 2 uses it in pricing

  • 0
Henryk Tews
Tuesday, 09 October 2018 / Published in Magento 2

Strategy is one of those patterns that seems like unnecessary complexity on first contact. Why wrap a single algorithm in a separate class? The value only becomes clear with a second and third algorithm – when instead of a growing if-else you have clean, interchangeable code. I show how it works in PHP and where Magento 2 uses this pattern without you realising it.

(more…)

Plugin vs Preference in Magento 2 – when to use which

  • 0
Henryk Tews
Tuesday, 11 September 2018 / Published in Magento 2

One of the most common questions when working with Magento 2 is: should I override a class with a preference, or use a plugin? The answer is almost always the same – use a plugin. But “almost” does a lot of work here. I explain the differences and show when a preference makes sense.

(more…)

  • 11
  • 12
  • 13
  • 14

© 2026 Created by

TOP
Zarządzaj zgodą
Aby zapewnić jak najlepsze wrażenia, korzystamy z technologii, takich jak pliki cookie, do przechowywania i/lub uzyskiwania dostępu do informacji o urządzeniu. Zgoda na te technologie pozwoli nam przetwarzać dane, takie jak zachowanie podczas przeglądania lub unikalne identyfikatory na tej stronie. Brak wyrażenia zgody lub wycofanie zgody może niekorzystnie wpłynąć na niektóre cechy i funkcje.
Funkcjonalne Always active
Przechowywanie lub dostęp do danych technicznych jest ściśle konieczny do uzasadnionego celu umożliwienia korzystania z konkretnej usługi wyraźnie żądanej przez subskrybenta lub użytkownika, lub wyłącznie w celu przeprowadzenia transmisji komunikatu przez sieć łączności elektronicznej.
Preferencje
Przechowywanie lub dostęp techniczny jest niezbędny do uzasadnionego celu przechowywania preferencji, o które nie prosi subskrybent lub użytkownik.
Statystyka
Przechowywanie techniczne lub dostęp, który jest używany wyłącznie do celów statystycznych. Przechowywanie techniczne lub dostęp, który jest używany wyłącznie do anonimowych celów statystycznych. Bez wezwania do sądu, dobrowolnego podporządkowania się dostawcy usług internetowych lub dodatkowych zapisów od strony trzeciej, informacje przechowywane lub pobierane wyłącznie w tym celu zwykle nie mogą być wykorzystywane do identyfikacji użytkownika.
Marketing
Przechowywanie lub dostęp techniczny jest wymagany do tworzenia profili użytkowników w celu wysyłania reklam lub śledzenia użytkownika na stronie internetowej lub na kilku stronach internetowych w podobnych celach marketingowych.
  • Manage options
  • Manage services
  • Manage {vendor_count} vendors
  • Read more about these purposes
Zobacz preferencje
  • {title}
  • {title}
  • {title}