The API Guys
PHP 8.5 release announcement with code snippets highlighting the pipe operator and new features
·5 min read·The API Guys

PHP 8.5 Is Here - What It Means for Your Laravel Projects

PHPLaravelSoftware UpdatesWeb DevelopmentSecurityAPI Development

PHP 8.5 officially landed on 20 November 2025, and it is packed with features that make writing clean, maintainable code easier than ever. For teams running Laravel applications - like the ones we build and maintain every day - this release is well worth paying attention to.

Here is a rundown of the headline features, what they mean in practice, and why staying current with PHP versions matters more than you might think.

The Pipe Operator

This is the one most developers have been waiting for. The pipe operator (|>) lets you chain function calls left to right, passing the result of each step into the next. No more deeply nested calls or throwaway variables cluttering your code.

Instead of writing something like this:

$slug = strtolower(str_replace(' ', '-', trim($title)));

You can now write:

$slug = $title |> trim(...) |> strtolower(...);

It reads naturally from left to right, and that matters when you are reviewing pull requests at half eight on a Monday morning. For Laravel projects where we are constantly transforming data - sanitising input, formatting API responses, building query parameters - this is going to clean things up significantly.

Clone With

PHP 8.5 introduces a new clone() syntax that lets you modify properties while cloning an object. This is a game-changer for anyone working with readonly classes and the "wither" pattern that has become popular in modern PHP.

If you have worked with Laravel's immutable value objects or built API response DTOs, you will immediately see the benefit. No more writing boilerplate withTitle(), withStatus() methods on every class - the language now handles it natively.

The URI Extension

PHP has finally got a proper, standards-compliant way to parse and handle URIs. The new built-in URI extension follows both RFC 3986 and the WHATWG URL standard, replacing the ageing parse_url() function that has been the source of countless subtle bugs over the years.

For API development, this is particularly welcome. We deal with URIs constantly - building endpoints, validating callback URLs, parsing webhook payloads - and having a reliable, standards-based tool built into the language removes an entire category of edge cases.

NoDiscard Attribute

The new #[NoDiscard] attribute lets you mark functions whose return values should not be ignored. If someone calls the function without using the result, PHP will now emit a warning.

This is excellent for API safety. Think about methods that return a result object or a status code - silently ignoring those return values is a common source of bugs. Now PHP can flag it for you at development time rather than letting it slip through to production.

Closures in Constant Expressions

Static closures and first-class callables can now be used in constant expressions, including attribute parameters. This opens up some genuinely powerful patterns, particularly around framework configuration and route definitions in Laravel.

Fatal Error Backtraces

This is one of those "finally" moments. Fatal errors - including the dreaded maximum execution time exceeded - now include full stack traces. If you have ever spent an afternoon trying to track down which recursive call is eating all your server time, you will appreciate just how much debugging time this saves.

Other Notable Additions

array_first() and array_last() are now built-in functions, eliminating the need for helper functions or Laravel's Arr::first() for simple cases. There is also a new max_memory_limit INI directive, an IntlListFormatter class for internationalisation, and OPcache is now statically compiled into PHP rather than being an optional extension.

Deprecations to Watch

As with every minor release, PHP 8.5 introduces deprecations that signal what will be removed in PHP 9.0. Non-canonical scalar type casts like (boolean) and (integer) are deprecated in favour of (bool) and (int). Backtick execution (`command`) is also on its way out. If you are running static analysis tools like PHPStan or Psalm - which you should be - these will flag any issues in your codebase.

Why Staying Current Matters

Every new PHP release brings performance improvements, security patches, and bug fixes. But the real risk of falling behind is not about missing out on new syntax - it is about running unsupported software.

PHP 8.2, for example, is now in security-only fixes and will reach end of life before you know it. If your application is still running on PHP 8.1 or earlier, you are already on borrowed time. No more bug fixes, no more security patches, and an increasingly difficult upgrade path the longer you leave it.

For Laravel projects specifically, staying on a supported PHP version ensures compatibility with the latest framework releases, access to the newest Composer packages, and the security updates that protect your users' data.

Our Recommendation

We would not suggest jumping straight to PHP 8.5.0 in production on day one. History has shown that waiting for at least the first patch release (8.5.1) is the sensible approach, giving the wider ecosystem time to catch up and any early bugs to be squashed.

In the meantime, make sure your applications are running at least PHP 8.3, ideally 8.4. Run your test suites against PHP 8.5 in CI. Check that your Composer dependencies support it. And start using static analysis tools like PHPStan or Rector to identify any deprecations that need addressing.

If you are unsure where your project stands or need help planning an upgrade, get in touch. Keeping your stack current is one of the most impactful things you can do for the long-term health of your application - and it is exactly the sort of thing we help teams with every day.

Ready to Start Your Project?

Get in touch with our Leeds-based team to discuss your Laravel or API development needs.