PHP 8.5 Is Here: The Pipe Operator, URI Extension, and More
PHP 8.5 shipped on November 20, 2025, and it is one of the more interesting language releases in recent memory. After years of incremental type-system and performance work, this version adds genuinely new syntax that changes how you write everyday code. Here is what landed and what it means if you build on Laravel.
The Pipe Operator
The headline feature is the pipe operator, |>. It takes the value on the left and passes it as the single argument to the callable on the right, letting you chain transformations left to right instead of nesting them inside-out.
// Before: read it from the inside out
$result = array_sum(array_filter(array_map($fn, $items)));
// After: read it top to bottom
$result = $items
|> fn ($x) => array_map($fn, $x)
|> fn ($x) => array_filter($x)
|> array_sum(...);
If you have used collection pipelines in Laravel, the mental model is identical: data flows through a series of steps. The difference is that the pipe operator works on any value with any callable, not just collections. It will not replace Laravel's fluent collections, but it is a nice tool for stringing together plain functions without a pile of nested parentheses.
A Proper URI Extension
For over two decades, parsing a URL in PHP meant parse_url(), a function that returns an associative array, silently mangles edge cases, and has no concept of validation. PHP 8.5 ships a real Uri extension with immutable objects, a fluent interface, and support for both RFC 3986 and the WHATWG URL standard.
$uri = new Uri\Rfc3986\Uri('https://example.com/path?page=2');
$uri->getHost(); // 'example.com'
$uri->getQuery(); // 'page=2'
// Immutable — returns a new instance
$next = $uri->withQuery('page=3');
For Laravel developers this is mostly a foundation-level win. Expect the framework and packages to gradually lean on it for more correct URL handling under the hood, but you can reach for it directly any time you need to parse or build URLs reliably.
Clone With Property Overrides
Cloning an object and then immediately reassigning a few properties has always been clunky, especially with readonly properties that you legally cannot reassign after construction. PHP 8.5 lets you override properties as part of the clone:
$updated = clone($order, ['status' => 'shipped', 'shipped_at' => now()]);
This is a real quality-of-life improvement for the immutable value-object style that has become popular in modern Laravel codebases. You can now produce a modified copy of a readonly object in a single expression.
The #[\NoDiscard] Attribute
Some return values should never be ignored — think a method that returns a result you must check, or a builder that returns a new immutable instance. Marking such a method with #[\NoDiscard] makes PHP emit a warning when the caller throws the return value away:
#[\NoDiscard('The filtered collection is a new instance')]
public function filter(callable $fn): static { /* ... */ }
This catches a whole class of silent bugs where a developer calls an immutable method and forgets to capture its result.
Smaller Wins
PHP 8.5 also adds array_first() and array_last() to complement the existing array_key_first() and array_key_last(), plus a handful of ergonomics improvements across the standard library.
Should You Upgrade?
PHP 8.5 stays in active support until the end of 2027 and receives security fixes through 2029. Laravel runs on it cleanly, and the performance numbers are real — independent benchmarks show double-digit speed gains on real-world applications. If you are on PHP 8.3 or 8.4, plan the move: bump your composer.json constraint, run your test suite, and check any packages that touch low-level URL parsing. The new syntax is opt-in, so nothing breaks just because you upgraded.
Sources: PHP 8.5 Release Announcement · PHP.Watch — PHP 8.5 · What's New in PHP 8.5 — stitcher.io