PHP: Guides and Practical Know-how | Page 13 | mironsoft Blog
PHP
-
Nov 9, 2025
Twig 3 splits the CoreExtension into smaller building blocks, changes escaping behavior for custom filters, and removes functions long marked deprecated. Teams that know these breaking changes before the Composer update and deliberately search for deprecations can migrate Symfony templates without unpleasant surprises in production.
-
Nov 7, 2025
Filesystem operations are among the most frequently untested parts of PHP applications. Anyone who calls file_get_contents() and file_put_contents() directly ends up writing code that either doesn't get tested at all, or leaves behind tests that create real files, have order dependencies, and break when run in parallel. vfsStream, stream wrappers and filesystem abstraction solve this problem at its root.
-
Nov 4, 2025
Anyone who wants to automatically rewrite, check or generate PHP code cannot avoid AST manipulation. The nikic/php-parser library turns source code into a searchable node tree that custom NodeVisitor classes can read and modify precisely, before the code is printed back out as clean, valid PHP source.
-
Nov 4, 2025
A memory leak first shows up as a steadily growing RES value in top, followed by ever tighter free memory and eventually an OOM kill in the middle of the day. Simply restarting the affected service buys time, not insight. This guide shows how to use built-in tools like smaps_rollup, smem and pmap to systematically find out which process is losing memory and where in the code or configuration the cause lies.
-
Nov 4, 2025
Anyone who catches every exception with a blanket catch (\Exception $e) loses the distinction between programming mistakes and expected runtime problems. This article shows how the built-in Throwable hierarchy and the SPL exceptions of PHP 8.4 enable robust error handling, including try/catch/finally, error conversion and clean exception logging.
-
Nov 4, 2025
Constructor property promotion collapses the classic threefold repetition of property declaration, constructor parameter, and body assignment into a single line per field, without giving up type safety, visibility, or readonly guarantees, and makes value objects and DTOs in particular noticeably more compact and maintainable.
-
Nov 2, 2025
Scattered mysql_ calls and string-concatenated SQL queries are one of the most common and most dangerous inheritances of old PHP projects. This article shows how to systematically replace such legacy database access with a unified PDO layer built on prepared statements, without interrupting operations.
-
Oct 30, 2025
PHP projects rarely rely on just one template engine. Magento projects combine PHTML with Alpine.js and Tailwind. Symfony projects mix Twig with PHP. Laravel projects use Blade, sometimes alongside Livewire. PHPStorm can support all of this at once, if you know which switches to flip.
-
Oct 27, 2025
Fibers give PHP code the ability to pause execution at almost any point in the call stack and resume exactly there later, without restructuring the calling logic into callbacks or generators. This article walks through the Fiber class step by step, from start and resume through error handling with throw to a custom cooperative scheduler and the real costs in memory and stack usage.
-
Oct 26, 2025
Sending a date as a plain string looks harmless until two clients expect different formats and the backend ends up duplicating validation. Custom scalars move format and validation into a single, reusable type in the schema, with clear rules for serialization, input parsing, and error cases.