PHP 8.5 Released with Major New Features for Developers

PHP 8.5 Released with Major New Features for Developers

The PHP language has reached version 8.5, introducing a host of new features aimed at improving developer productivity, performance, and API safety.

Key enhancements include a built-in URI extension for parsing, normalizing, and handling URLs, based on RFC 3986 and WHATWG standards. This reduces reliance on third-party libraries for many common URI tasks.

The new pipe operator (|>) enables chaining of function calls in a left-to-right fashion, making imperative code more readable and less nested.

PHP 8.5 introduces a “clone with” syntax that allows cloning objects and modifying their properties in a single step. This improves support for the "with-er" pattern, particularly for readonly classes.

The new #[\NoDiscard] attribute emits a warning when a function’s return value is unused, encouraging safer API usage. Additionally, static closures and first-class callables can now be used in constant expressions such as attribute parameters and default values.

Support for persistent cURL share handles via curl_share_init_persistent() allows reusing handles across requests, reducing connection overhead.

The update also adds array_first() and array_last() functions, stronger error reporting with backtraces, and new APIs across DOM, grapheme handling, and cookies. Other additions include new attribute targets and improvements to constructor property promotion and visibility controls.

Deprecated features include the backtick operator as an alias for shell_exec(), non-canonical type cast names, and use of null as an array offset. Developers are encouraged to review the full migration guide and test compatibility before upgrading.

For comprehensive details on the release and migration considerations, visit the PHP 8.5 Release Announcement.

Disclosure: This content is produced with the assistance of AI.

Note: The vision of this web portal is to help promote news and stories around the Drupal community and promote and celebrate the people and organizations in the community. We strive to create and distribute our content based on these content policy. If you see any omission/variation on this please reach out to us at #thedroptimes channel on Drupal Slack and we will try to address the issue as best we can.

Related Organizations

Upcoming Events

Latest Opportunities