PHP 8.4 Brings Property Hooks and Asymmetric Visibility
PHP 8.4, released November 21, 2024, introduces property hooks for getter/setter logic, asymmetric visibility, and a new HTML5-compliant DOM API.
PHP 8.4 was released on November 21, 2024, introducing property hooks, asymmetric visibility, and a new HTML5-compliant DOM API. This release received the highest number of RFCs since PHP 8.0, with 36 accepted proposals.
Property Hooks
The most significant addition is property hooks, allowing custom logic when getting or setting property values without explicit getter/setter methods:
class User {
public string $fullName {
get => $this->firstName . ' ' . $this->lastName;
set => [$this->firstName, $this->lastName] = explode(' ', $value, 2);
}
}
This eliminates boilerplate while maintaining the clean public property syntax.
Asymmetric Visibility
Properties can now have different visibility for reading and writing:
class BankAccount {
public private(set) float $balance = 0.0;
}
The $balance property can be read publicly but only modified within the class.
New DOM API with HTML5 Support
PHP 8.4 introduces Dom\HTMLDocument, leveraging the Lexbor parser for spec-compliant HTML5 parsing. This fixes long-standing issues with the old DOM extension's handling of modern HTML.
New Array Functions
Four new array functions simplify common operations:
array_find()- Find first element matching a callbackarray_find_key()- Find key of first matching elementarray_any()- Check if any element matchesarray_all()- Check if all elements match
Support Lifecycle
PHP 8.4 will receive bug fixes until December 2026 and security fixes until December 2028, making it a solid choice for new projects.
Related Articles
Redis 8.4 Brings Hybrid Search, Atomic Multi-Key Operations, and Auto-Repair AOF
Redis 8.4 is now generally available, delivering hybrid search that combines full-text and vector queries using Reciprocal Rank Fusion, new atomic string commands like MSETEX and DELEX, and automatic repair for corrupted append-only files. Lookahead prefetching and JSON memory optimizations round out a performance-focused release.
Deno 2.7 Stabilizes Temporal API and Ships Native Windows ARM Builds
Deno 2.7 has stabilized the TC39 Temporal API, bringing immutable, timezone-aware date and time objects to replace the legacy JavaScript Date API. The release also delivers official Windows ARM builds for Surface and Snapdragon devices, npm overrides support, and global install compilation for standalone executables.
Laravel 13 Ships with PHP Attributes, Passkeys, and Zero Breaking Changes
Taylor Otwell unveiled Laravel 13 at Laracon EU, delivering PHP 8 Attributes as an alternative to class properties, built-in passkey authentication in starter kits, and a new Reverb database driver for horizontal WebSocket scaling. The release requires PHP 8.3+ and promises the smoothest upgrade path in Laravel history.