PHP: Guides and Practical Know-how | Page 23 | mironsoft Blog
PHP
-
Jun 24, 2025
Xdebug with Docker is not a one-click setup: host.docker.internal, port 9003, path mappings, the correct xdebug.mode, and PHPStorm server configuration all have to line up. This article systematically puts every piece into the right position, for stable breakpoints in Magento 2 and other PHP projects.
-
Jun 21, 2025
When an external API turns slow or stops responding, every calling request in a typical PHP application just waits for its timeout, while PHP-FPM workers pile up in the background and drag the whole application down with them. The circuit breaker pattern breaks this chain: after a configured number of failures it trips the circuit and answers further calls immediately with a fallback instead of letting them run into the same dead end again.
-
Jun 21, 2025
ObjectManager::getInstance()->get() hides dependencies, makes testing impossible, and blocks static analysis. Everything about the Service Locator anti-pattern, and the correct alternative.
-
Jun 20, 2025
Functional composition assembles small, individually tested functions into a new function, instead of nesting calls deeply inside one another. With a self-written compose() function, this pattern can be implemented in PHP 8.4 in a type-safe way and without any extra dependency.
-
Jun 17, 2025
PHP manages memory seemingly invisibly in the background, but understanding how Reference Counting, the Zend Memory Manager, and Garbage Collection actually work together lets you spot memory leaks in long-running processes before they become a production incident. This article explains the zval structure, circular references, the Cycle Collector algorithm, and the practical tools for diagnosis, for PHP developers who want to think beyond just memory_limit.
-
Jun 13, 2025
A test that turns red on every implementation change without the observable behavior having changed is not a test, it is an obstacle. Overspecified mocks, testing your own classes through mocks, spy abuse, and expectation overload are the most common causes of brittle PHPUnit suites that create more maintenance effort than confidence.
-
Jun 6, 2025
Before using ReactPHP or Swoole in production, it is worth looking at what actually happens underneath. Non-blocking I/O in PHP relies on the same operating system primitives as in any other language: sockets running in non-blocking mode, and stream_select signaling which sockets are ready. Understanding these fundamentals means every async framework becomes clear at a glance.
-
Jun 6, 2025
PHP 8.0 introduced native union types, PHP 8.1 followed with intersection types for combining interfaces, and PHP 8.2 tied both concepts together with disjunctive normal form. Using these constructs correctly replaces vague PHPDoc comments with real, engine-checked type declarations and makes signatures instantly readable for IDE completion and static analysis tools such as PHPStan and Psalm.
-
Jun 4, 2025
GraphQL often looks like a finished black box in frontend tutorials, yet a working server in PHP can be built with comparatively little code. We use webonyx/graphql-php as a lightweight base for the type system and execution, define schema and resolvers by hand, and show exactly how the notorious N+1 problem arises and how it can be solved without a dedicated DataLoader library.
-
May 31, 2025
Laravel Blade brings its own composition system for server rendered views through components, attribute bags and @props, and Tailwind CSS adds a consistent utility system for styling on top. Setting up Tailwind CSS cleanly in Laravel Blade projects gives you reusable components, a lean Vite build pipeline and a CSS bundle that only contains the classes actually in use.