Next.js is the most popular React framework for building full-stack web applications with server-side rendering. For a PHP developer the concepts of SSR, static generation, and server-side data fetching are familiar – they are what PHP has always done. What is new is the React component model and the hybrid approach where some code runs on the server and some in the browser. I show Next.js from a PHP perspective with Magento 2 GraphQL as the backend.

(more…)

Visitor is one of the less commonly used GoF patterns, but it solves a specific problem elegantly: adding new operations to an object hierarchy without modifying the hierarchy itself. Double dispatch – calling different methods based on both the visitor type and the element type – is the mechanism. I show a PHP implementation and apply it to a real scenario: exporting product data to CSV and PDF without adding export logic to the product classes.

(more…)

Hyvä Theme has become the default choice for new Magento 2 projects. It replaces the Knockout.js and RequireJS stack with Alpine.js and Tailwind CSS, keeping templates in standard PHP/PHTML with no build step for JavaScript. The result is dramatically simpler frontend code and Lighthouse scores that Luma could never reach. I show the architecture and how development actually differs from Luma.

(more…)

PHP 8.4 is due in November 2024 and its headline features address two long-standing awkwardnesses. Property hooks allow computed and validated properties without getter/setter boilerplate. Asymmetric visibility lets you expose a property publicly for reading but restrict writing to the class. Chaining on new without parentheses removes a syntactic annoyance. I preview all three with practical examples.

(more…)

TOP