PHP 8.4 brings some of the most practical developer-experience upgrades in years for engineers building backends on Symfony and Drupal 11. Beyond Zend engine speedups, two features drastically cut daily boilerplate: Property Hooks and asymmetric visibility.
1. Property Hooks: Replacing Trivial Getters and Setters
Validating or normalizing a property on assignment used to require private fields plus manual getter/setter methods. PHP 8.4 lets you attach get and set hooks directly to the property:
class ArticleMetadata {
public string $slug {
set(string $value) => strtolower(trim(preg_replace('/[^a-z0-9]+/i', '-', $value), '-'));
}
public function __construct(
public private(set) string $author = 'Carlos Del Hierro',
) {}
}
2. Asymmetric Visibility (public private(set))
With public private(set), DTOs and API response objects can expose read-only public properties without allowing external mutation.
3. Built-in array_find(), array_any() & array_all()
array_find($items, fn($x) => $x->isActive())returns the first matching item cleanly without manualforeachloops.array_any()andarray_all()make business-rule validators shorter and easier to read.
Upgrading your Drupal 10/11 or Symfony stack to PHP 8.4 reduces memory overhead, lowers TTFB, and keeps your codebase modern.