PHP 8.4 Features I Actually Use Every Day in Laravel

PHP 8.4 shipped some genuinely useful features — not just syntax sugar, but patterns that change how you structure classes and handle data. Here are the ones I reach for daily in my Laravel projects.

Property Hooks

This is the biggest addition. You can now define get and set behavior directly on properties, replacing the old pattern of private properties with getter/setter methods:

PHP

Where this really shines is in value objects and DTOs:

PHP

No more getFormattedAmount() methods cluttering your class. The property is the API.

Asymmetric Visibility

You can now have a property that's publicly readable but only settable from within the class:

PHP

Before PHP 8.4, you had two choices: make the property public (and risk external mutation) or make it readonly (and lose the ability to modify it internally). Asymmetric visibility gives you the best of both — public reads, private writes.

I use this in action classes for properties that should be inspectable but not modifiable from outside:

PHP

new Without Parentheses

Small but satisfying — you can now chain methods on new expressions without wrapping them in parentheses:

Before PHP 8.4

It's a readability improvement you notice everywhere once you start using it. Especially in tests:

PHP

New Array Functions

PHP finally has array_find(), array_any(), and array_all(). These replace verbose foreach loops with one-liners:

PHP

In Laravel you'd often use collections for this, but for raw arrays — config values, parsed data, non-Eloquent contexts — these are cleaner than array_filter + reset() hacks.

The #[\Deprecated] Attribute

If you maintain packages (I maintain several), this is a game-changer. You can now mark methods as deprecated with a native attribute:

PHP

The difference from a @deprecated PHPDoc tag: this triggers an actual E_USER_DEPRECATED notice at runtime. Static analyzers, IDEs, and Laravel's error handler all pick it up. Your users get a real warning, not just a strikethrough in their IDE.

Multibyte ucfirst() and lcfirst()

For anyone working with multilingual applications, PHP 8.4 adds mb_ucfirst() and mb_lcfirst():

PHP

If you're building anything with translations or user-generated content in non-English languages, this replaces the mb_strtoupper(mb_substr(...)) workaround.

The Bigger Picture

PHP 8.4 isn't about flashy syntax — it's about reducing boilerplate in the patterns you use constantly. Property hooks eliminate getter/setter classes. Asymmetric visibility replaces the readonly-vs-public tradeoff. The array functions kill foreach loops for simple searches.

Combined with features from earlier versions — constructor promotion, enums, match expressions — modern PHP is genuinely concise and expressive. If you're still writing PHP 7-style code in a PHP 8.4 project, you're leaving a lot on the table.

Related articles