What’s New in PHP 8.5? Pipe Operators, PFA, and Upcoming Features Explained
The article reviews PHP 8.5’s late‑2025 release, highlighting enhanced pipe operators, partial function application (PFA), object‑cloning syntax, closure improvements, richer fatal‑error stack traces, and upcoming RFCs such as pattern matching, while also covering related runtimes like FrankenPHP, the Mago toolchain, TrueAsync, and the PHPverse conference.
PHP 8.5 Release
PHP 8.5 was officially released at the end of November 2025, but most developers will start adopting it in 2026. The release brings several notable features, including an improved pipe operator and a new way to clone objects while passing data.
Pipe Operator and Partial Function Application (PFA)
The pipe operator now works seamlessly with partial function application, allowing developers to create callable references with pre‑filled arguments. This enables concise pipelines such as:
$output = $input
|> trim(...)
|> (fn (string $string) => str_replace(' ', '-', $string))
|> (fn (string $string) => str_replace(['.', '/', '…'], '', $string))
|> strtolower(...);Partial function application introduces a placeholder ("?") that can be replaced later, making the pipeline even more flexible.
Object Cloning with Data
PHP 8.5 adds syntax to clone an object while simultaneously overriding selected properties:
final class Book {
public function __construct(public string $title, public string $description) {}
public function withTitle(string $title): self {
return clone $this, ['title' => $title];
}
}This feature simplifies immutable‑style updates.
Closure Improvements
Closures can now be used directly in attributes, for example:
#[SkipDiscovery(static function (Container $c): bool {
return ! $c->get(Application::class) instanceof ConsoleApplication;
})]
final class BlogPostEventHandlers { /* … */ }Improved Fatal Error Stack Traces
When a fatal error occurs, PHP 8.5 provides a detailed stack trace, helping developers pinpoint the exact call chain leading to the failure.
Fatal error: Maximum execution time of 1 second exceeded in example.php on line 6
Stack trace:
#0 example.php(6): usleep(100000)
#1 example.php(7): recurse()
#2 ...Pattern Matching RFC (Under Discussion)
A promising RFC introduces pattern matching syntax similar to other modern languages. An example looks like:
$string = match($object) is {
Foo => 'foo',
Bar => 'bar',
Baz | Beep => 'baz',
};
if ($var is 'heart' | 'spade' | self::Wild) {
// Hello!
}FrankenPHP Runtime
FrankenPHP is a Go‑based PHP runtime offering a worker mode for long‑running scripts, a “compile to binary” option for fast deployment, and modern HTTP capabilities. Its proponents hope it will become the default runtime, claiming up to a 10 % performance boost over PHP‑FPM.
Mago Toolchain
Mago is a Rust‑written, all‑in‑one PHP toolchain that bundles a code formatter (similar to Laravel Pint), a linter, and a static analyzer (akin to PHPStan or Rector). It aims for high speed and consistency across projects.
TrueAsync Async PHP
TrueAsync continues work on asynchronous PHP, drafting its seventh RFC. While some focus on multithreading for CPU‑bound tasks, the author believes async I/O will have a larger short‑term impact on PHP applications.
PHPverse Conference
The PHPverse online conference attracted over 5,000 live viewers in its previous edition and will return in 2026, reflecting the growing enthusiasm in the PHP community.
Personal Note on Tempest
The author mentions contributing to the Tempest project (https://tempestphp.com/), a modern PHP framework with more than 80 contributors and 600 Discord members, and expresses optimism for its progress in 2026.
21CTO
21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
