PHP 8.4 Features I can’t live without anymore

Auteur(s) de l'article

PHP 8.4 was released on November 21, 2024. Today is… well, let’s just say it’s been a while. 
A futuristic, cybernetic blue PHP elephant mascot, glowing with neon purple and blue energy, emerging triumphantly from a pile of dusty, broken, outdated stone code blocks and tangled rusty chains. The elephant has sleek metallic armor and integrated glowing "hooks" on its trunk. In the background, a holographic interface displays clean, glowing PHP 8.4 syntax. The overall style is isometric digital art, highly detailed, tech-noir atmosphere, cinematic lighting. The text "PHP 8.4" is prominent and glowing in the center.
Sneak peek of PHP 8.4's QOL upgrades, brought to life by Nano Banana 🐘
As we say in French: mieux vaut tard que jamais — better late than never. And let’s be honest, when you’re juggling production projects, client deadlines, and that one legacy codebase that refuses to die, upgrading PHP isn’t always day-one priority.
But here we are! And I’m genuinely excited to share these features with you — even if half of you have probably been using them in production for months. No judgment from me. Okay, maybe a little judgment towards myself.

🪝Property Hooks — The Game Changer

Property hooks might be the biggest quality-of-life improvement since constructor property promotion. I’m not being dramatic — this genuinely changes how I write classes.
No more boilerplate getters. No more repetitive setters. You define the logic directly on the property itself.
Before PHP 8.4, a simple class with getters & seters looked like this:
class Player {
    private string $email;
    private string $firstName;
    private string $lastName;

    public function getEmail(): string {
        return $this->email;
    }

    public function setEmail(string $email): void {
        if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
            throw new InvalidArgumentException('Invalid email format');
        }
        $this->email = $email;
    }

    public function getFirstName(): string {
        return $this->firstName;
    }

    public function setFirstName(string $firstName): void {
        if (empty(trim($firstName))) {
            throw new InvalidArgumentException('First name cannot be empty');
        }
        $this->firstName = trim($firstName);
    }

    public function getLastName(): string {
        return $this->lastName;
    }

    public function setLastName(string $lastName): void {
        if (empty(trim($lastName))) {
            throw new InvalidArgumentException('Last name cannot be empty');
        }
        $this->lastName = trim($lastName);
    }

    public function getFullName(): string {
        return $this->firstName . ' ' . $this->lastName;
    }
}
As of PHP 8.4, all of that boilerplate can be reduced to this:
class Player {
    public string $email {
        set {
            if (!filter_var($value, FILTER_VALIDATE_EMAIL)) {
                throw new InvalidArgumentException('Invalid email format');
            }
            $this->email = $value;
        }
    }

    public string $firstName {
        set => trim($value) ?: throw new InvalidArgumentException('First name cannot be empty');
    }

    public string $lastName {
        set => trim($value) ?: throw new InvalidArgumentException('Last name cannot be empty');
    }

    public string $fullName {
        get => $this->firstName . ' ' . $this->lastName;
    }
}
Here’s the cool part: $fullName is a virtual property. It doesn't actually store data — it's computed on-the-fly from firstName and lastName. No wasted memory, no sync issues.
I could keep going, but others have already explored this better than I could. For the full deep-dive — asymmetric visibility, edge cases & advanced usage — check out these two excellent articles: Property Hooks in PHP 8.4: Game Changer or Hidden Trap? & PHP 8.4 Property Hooks: The Game-Changer You’ve Been Waiting For.

🆕 new without Parentheses — Goodbye Brackets

PHP 8.4 brings another small-but-mighty improvement: you don’t have to wrap new invocations in parentheses anymore to chain methods.
Instead of this gymnastics:
$name = (new MyClass())->myMethod();
You can now simply write:
$name = new MyClass()->myMethod();
This might seem like a small change, but small improvements to developer experience compound over time. Your future self will thank you.

🏁 The #[Deprecated] Attribute — Finally, Native Support

Remember the good old /** @deprecated */ docblock? Sure, PHPStorm understood it, and static analysers like PHPStan could catch it — but PHP itself? It couldn't care less. You were basically leaving a polite note that the language completely ignored.
Well, not anymore. PHP 8.4 introduces a native #[Deprecated] attribute that the engine actually respects. And the cherry on top? It enforces metadata to explain what to use instead and since when it's deprecated:
#[Deprecated(
    message: "use writeArticleOnTime() instead",
    since: "kevin/procrastination:13.0"
)]
function writeArticleAboutPHP84(): void
{
    // I'll do it next week, I promise
}
PHP 8.4 might be old news by now, but these features are here to stay. Property hooks, cleaner instantiation, native deprecations — small wins that make daily coding just a bit more enjoyable.
Now if you’ll excuse me, I have a PHP 8.5 article to procrastinate on.
❤️ Love on your keyboards.

Sources

stitcher.io (Nov 2024) What’s new in PHP 8.4.
https://stitcher.io/blog/new-in-php-84
David Grudl (Nov 2024). Property Hooks in PHP 8.4: Game Changer or Hidden Trap?
https://phpfashion.com/en/property-hooks-in-php-8-4
Matthias Breddin (Nov 2025). PHP 8.4 Property Hooks: The Game-Changer You’ve Been Waiting For.
https://fsck.sh/en/blog/php-84-property-hooks-guide
PHP RFC (Dec 2022) Property hooks.
https://wiki.php.net/rfc/property-hooks
PHP RFC (Dec 2023) new MyClass()->method() without parentheses.
https://wiki.php.net/rfc/new_without_parentheses
PHP RFC (May 2024) #[\Deprecated] Attribute.
https://wiki.php.net/rfc/deprecated_attribute

Resources

Claude AI, https://claude.ai
Helped with writing and text refinement.
Nano Banana, https://gemini.google/overview/image-generation
Generated the very accurate article’s cover illustration.