PHP 8.4: Main features, Property Hooks and new standards for 2025
In August 2025, the PHP community officially moved to a new level - a large-scale release took place PHP 8.4. This update finally blurs the boundaries between PHP and "strict" enterprise languages like C# and Java, bringing deep syntactic sugar and the long-awaited refactoring of DOM libraries.
Let's look at the 3 main features that make you want to update your projects today.
1. Property Hooks: The end of the era of getters and setters
Traditionally, in encapsulation we wrote Boilerplate code: private property, public get() and public set($value). PHP 8.4 takes the best of C# and Kotlin, introducing Property Hooks.
Now the logic for intercepting access to a Property can be described right inside its declaration:
class User {
public string $name {
// Хук записи: убираем лишние пробелы и форматируем
set (string $value) => ucfirst(trim($value));
// Хук чтения: добавляем префикс
get => "User: " . $this->name;
}
}
$user = new User();
$user->name = " daniil ";
echo $user->name; // Выведет "User: Daniil"What does this mean for business? Symfony and Laravel codebases will be reduced by thousands of lines. Models (Entities / DTOs) will become 2 times shorter and more readable, since endless access methods will disappear from them.
Free SEO audit of your website
Leave a request and our specialists will find areas of search traffic growth.
2. Asymmetric Visibility: DTO protection out of the box
Creating immutable DTOs (Data Transfer Objects) has always been a pain. readonly properties solved some of the problems, but did not allow changing data from inside the class.
PHP 8.4 introduced Asymmetric visibility (Asymmetric Visibility). You can separately specify the scope for reading and writing a property:
class Article {
// Читать может кто угодно. Изменять (set) - только сам класс
public private(set) string $title;
public function __construct(string $title) {
$this->title = $title;
}
public function updateTitle(string $newTitle): void {
// Мы можем изменить это внутри класса! Readonly такого не позволял.
$this->title = strtoupper($newTitle);
}
}This is the ultimate tool for designing a strict architecture (Domain-Driven Design), where the state of an object should only be changed through its public mutator methods.
3. Native work with HTML5 (New DOM API)
Old package ext-dom (based on libxml2), which we had been using for decades to parse HTML, did not understand modern web standards at all. Trying to load semantic HTML5 into it caused a bunch of parsing errors and broken encoding.
PHP 8.4 adds a completely new WHATWG-compliant parsing package: \Dom\HTMLDocument.
use Dom\HTMLDocument;
// Больше никаких предупреждений о неизвестном теге <main> или <article>!
$doc = HTMLDocument::createFromString('
<main>
<article>PHP 8.4 is awesome</article>
</main>
');This is a huge plus for projects on data parsing and creating static generators.
Performance and Security (Security Audit)
In addition to the syntax, the kernel has been seriously optimized:
- JIT (Just-In-Time) compiler has been redesigned. In synthetic tests of Laravel and Symfony, development of business logic accelerated by 12-15%.
- В августе 2025 независимая комиссия (OSTIF & Sovereign Tech Agency) performed a deep kernel audit, closing 17 potential memory leak vulnerabilities (use-after-free).
- Extended support cycle: Active Support for new releases has been increased to two full years.
Free project cost estimate
Answer 4 questions and we will send you a range of prices to suit your needs.
1. What type of corporate website do you need?
Summary
PHP 8.4 is not “just an update under the hood”. This is a release that forces you to write code in a new way. Asymmetric visibility and Property Hooks make code elegant, secure, and concise.
Backend engineers NBM-IT specialize in Highload architecture and write in the latest PHP 8.3+ standards. Leave a request if your project requires scalable APIs or a seamless migration from legacy code to a new version of PHP.
