惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
罗磊的独立博客
MyScale Blog
MyScale Blog
博客园 - 叶小钗
U
Unit 42
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
有赞技术团队
有赞技术团队
F
Fortinet All Blogs
WordPress大学
WordPress大学
美团技术团队
GbyAI
GbyAI
L
LangChain Blog
T
The Blog of Author Tim Ferriss
P
Proofpoint News Feed
Y
Y Combinator Blog
V
Visual Studio Blog
小众软件
小众软件
D
Docker
量子位
博客园_首页
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Engineering at Meta
Engineering at Meta
N
Netflix TechBlog - Medium
M
MIT News - Artificial intelligence
人人都是产品经理
人人都是产品经理
C
CERT Recently Published Vulnerability Notes
AI
AI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Know Your Adversary
Know Your Adversary
Vercel News
Vercel News
C
Check Point Blog
I
InfoQ
NISL@THU
NISL@THU
Webroot Blog
Webroot Blog
S
Security Affairs
Stack Overflow Blog
Stack Overflow Blog
V
Vulnerabilities – Threatpost
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
TaoSecurity Blog
TaoSecurity Blog
L
Lohrmann on Cybersecurity
Hacker News: Ask HN
Hacker News: Ask HN
C
CXSECURITY Database RSS Feed - CXSecurity.com
N
News and Events Feed by Topic
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
W
WeLiveSecurity
V2EX - 技术
V2EX - 技术
SecWiki News
SecWiki News
PCI Perspectives
PCI Perspectives
S
Secure Thoughts
Apple Machine Learning Research
Apple Machine Learning Research

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
What’s New in PHP 8.5
Stevie G · 2026-05-14 · via DEV Community

PHP 8.5 is here, and while it may not feel quite as dramatic as PHP 8.4’s property hooks and asymmetric visibility, it brings some excellent quality-of-life improvements for everyday PHP developers.

This release focuses on cleaner code, safer APIs, better debugging, improved URL handling, and small but useful syntax improvements.

In this article, we’ll look at the most important PHP 8.5 features with simple examples.


1. The New Pipe Operator

One of the biggest additions in PHP 8.5 is the new pipe operator: |>.

The pipe operator lets you pass the result of one expression into the next function, making transformation code easier to read from left to right.

Before PHP 8.5

$title = ' PHP 8.5 Released ';

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

echo $slug;

Enter fullscreen mode Exit fullscreen mode

PHP 8.5

$title = ' PHP 8.5 Released ';

$slug = $title
    |> trim(...)
    |> (fn($value) => str_replace(' ', '-', $value))
    |> (fn($value) => str_replace('.', '', $value))
    |> strtolower(...);

echo $slug;

Enter fullscreen mode Exit fullscreen mode

Why it’s useful

This makes code easier to follow because each step happens in order.

Instead of reading deeply nested function calls from the inside out, you can read the logic from top to bottom.

This is especially useful when cleaning strings, processing arrays, transforming request data, formatting output, or building readable data pipelines.


2. New URI Extension

PHP 8.5 adds a new built-in URI extension for working with URLs and URIs in a more structured way.

For years, PHP developers have often used parse_url(), manual string handling, or third-party packages for more advanced URL work. PHP 8.5 gives us a more modern object-based option.

Before PHP 8.5

$parts = parse_url('https://example.com/blog/php-85');

echo $parts['host'];

Enter fullscreen mode Exit fullscreen mode

PHP 8.5

use Uri\Rfc3986\Uri;

$uri = new Uri('https://example.com/blog/php-85');

echo $uri->getHost();

Enter fullscreen mode Exit fullscreen mode

Why it’s useful

This is useful for web applications, routing, APIs, redirects, crawlers, scrapers, and security-sensitive URL validation.

Working with URLs can become surprisingly messy once you deal with hosts, paths, query strings, fragments, encoded characters, redirects, and edge cases.

Having a proper URI API built into PHP is a very welcome improvement.


3. Clone With

PHP 8.5 introduces a cleaner way to clone an object while changing selected properties.

This is especially helpful for immutable objects and readonly classes.

Example

readonly class UserProfile
{
    public function __construct(
        public string $name,
        public string $email,
        public string $role
    ) {}

    public function withRole(string $role): self
    {
        return clone($this, [
            'role' => $role,
        ]);
    }
}

$user = new UserProfile(
    name: 'Steve',
    email: 'steve@example.com',
    role: 'user'
);

$admin = $user->withRole('admin');

echo $admin->role;

Enter fullscreen mode Exit fullscreen mode

Why it’s useful

This makes immutable objects easier to work with.

Instead of manually copying every property into a new object, you can clone the existing object and change only what needs to change.

This is excellent for value objects, DTOs, configuration objects, and clean domain modelling.

For example, if you had a Money, Address, UserProfile, EmailMessage, or AppConfig object, you could create a modified copy without mutating the original object.


4. #[\NoDiscard] Attribute

PHP 8.5 adds a new #[\NoDiscard] attribute.

This tells PHP that the return value of a function should not be ignored. If the function is called and the return value is not used, PHP can warn you.

Example

#[\NoDiscard]
function validateEmail(string $email): bool
{
    return filter_var($email, FILTER_VALIDATE_EMAIL) !== false;
}

validateEmail('test@example.com');

Enter fullscreen mode Exit fullscreen mode

In this example, the return value is ignored.

That defeats the purpose of calling a validation function.

Correct usage

$isValid = validateEmail('test@example.com');

if ($isValid) {
    echo 'Email is valid';
}

Enter fullscreen mode Exit fullscreen mode

Intentionally ignoring the result

(void) validateEmail('test@example.com');

Enter fullscreen mode Exit fullscreen mode

Why it’s useful

This is great for functions where ignoring the return value could cause bugs.

Examples include:

  • validation functions
  • security checks
  • save or update operations
  • parsing functions
  • result-based service calls

This makes APIs safer and encourages developers to handle important return values properly.


5. array_first() and array_last()

PHP 8.5 adds two small but very useful array helper functions: array_first() and array_last().

These return the first or last value from an array, or null if the array is empty.

Before PHP 8.5

$users = ['Steve', 'Jessica', 'Tony'];

$firstUser = $users[array_key_first($users)];
$lastUser = $users[array_key_last($users)];

echo $firstUser;
echo $lastUser;

Enter fullscreen mode Exit fullscreen mode

PHP 8.5

$users = ['Steve', 'Jessica', 'Tony'];

$firstUser = array_first($users);
$lastUser = array_last($users);

echo $firstUser;
echo $lastUser;

Enter fullscreen mode Exit fullscreen mode

Why it’s useful

This removes boilerplate and makes code easier to understand.

It also works nicely with the null coalescing operator.

$latestEvent = array_last($events) ?? 'No events found';

Enter fullscreen mode Exit fullscreen mode

Simple, clean, and readable.


6. Fatal Errors Now Include Backtraces

PHP 8.5 improves debugging by adding stack trace support for fatal errors.

This is a big win when trying to track down problems in real applications.

Why it’s useful

Fatal errors can be painful, especially when they happen deep inside a codebase.

A backtrace gives you more context about where the problem came from, making debugging faster and less frustrating.

For developers working on large PHP systems, this is one of those features that may not look exciting at first, but it will save time when something breaks.


7. New get_error_handler() and get_exception_handler() Functions

PHP 8.5 adds two new functions:

get_error_handler();
get_exception_handler();

Enter fullscreen mode Exit fullscreen mode

These allow you to inspect the currently registered error and exception handlers.

Why it’s useful

This is handy for frameworks, debugging tools, logging systems, and applications that temporarily replace error handlers.

It gives developers more visibility into how errors and exceptions are being managed.

For example, this can help when debugging applications that use custom error handlers, middleware, framework bootstrapping, or testing tools.


8. Better CLI Configuration Checking

PHP 8.5 adds a useful CLI improvement:

php --ini=diff

Enter fullscreen mode Exit fullscreen mode

This can show non-default INI settings.

Why it’s useful

This is excellent for developers and system administrators.

When working across local, staging, and production environments, configuration differences can cause unexpected bugs.

Being able to quickly see which INI settings differ from the defaults makes PHP environments easier to debug and compare.

For example, it can help answer questions like:

  • Why does this work locally but fail on production?
  • Is the memory limit different on staging?
  • Is error reporting configured differently?
  • Are extensions or settings behaving differently between environments?

For anyone managing real-world PHP applications, this is a very practical addition.


9. New max_memory_limit INI Directive

PHP 8.5 introduces a new max_memory_limit directive, which can set a ceiling for memory_limit.

Why it’s useful

This is useful for hosting providers, shared environments, production servers, and systems where you want tighter control over memory usage.

It helps prevent scripts or local configuration changes from raising memory limits beyond an allowed maximum.

For production environments, this is a sensible improvement because memory issues can quickly affect reliability.


10. Closures and First-Class Callables in Constant Expressions

PHP 8.5 also allows static closures and first-class callables in constant expressions.

This can be useful when you want to define reusable behaviour in places that previously could not support it.

Example

function formatName(
    string $name,
    array $formatters = [
        trim(...),
        strtolower(...),
    ]
): string {
    foreach ($formatters as $formatter) {
        $name = $formatter($name);
    }

    return $name;
}

echo formatName(' STEVE ');

Enter fullscreen mode Exit fullscreen mode

Why it’s useful

This is more of an advanced feature, but it opens the door for cleaner configuration, attributes, callbacks, and reusable pipelines.

It also works nicely with the broader PHP direction of making functions and callables easier to pass around.


11. Persistent cURL Share Handles

PHP 8.5 adds support for persistent cURL share handles.

This can help avoid repeated setup costs when PHP makes multiple HTTP requests across requests, especially when sharing things like DNS cache and SSL sessions.

Why it’s useful

For many smaller applications, you may never directly touch this feature.

However, for applications that make lots of HTTP requests, API calls, webhooks, crawler requests, or service-to-service calls, this can help improve efficiency.

This is one of those lower-level improvements that framework and library authors may take advantage of before most everyday developers notice it directly.


12. Important Deprecations

Like every PHP release, PHP 8.5 also includes deprecations.

Some of the notable ones include non-canonical scalar casts such as (boolean), (integer), (double), and (binary).

Developers should use (bool), (int), (float), and (string) instead.

Example

// Old style
$isActive = (boolean) $value;
$count = (integer) $number;

// Recommended
$isActive = (bool) $value;
$count = (int) $number;

Enter fullscreen mode Exit fullscreen mode

The backtick operator as an alias for shell_exec() has also been deprecated.

Before

$output = `ls -la`;

Enter fullscreen mode Exit fullscreen mode

Prefer explicit code

$output = shell_exec('ls -la');

Enter fullscreen mode Exit fullscreen mode

Why it matters

Deprecations are warnings about the future.

Your code may still work today, but cleaning these up early makes future upgrades easier.

This is especially important if you maintain older PHP systems, custom CMS projects, WordPress plugins, Laravel applications, legacy business systems, or long-running internal tools.


Other Smaller Improvements

PHP 8.5 also includes several smaller improvements worth knowing about:

  • attributes can now target constants
  • #[\Override] can now be applied to properties
  • #[\Deprecated] can now be used on traits and constants
  • static properties now support asymmetric visibility
  • setcookie() and setrawcookie() now support the partitioned key
  • new DOM methods are available
  • new internationalisation improvements have been added
  • new PHP build constants are available

These are not always headline features, but they continue PHP’s movement toward cleaner, safer, and more expressive code.


Conclusion

PHP 8.5 is a practical release.

It may not feel as visually dramatic as PHP 8.4, but it brings several improvements that developers will actually use.

The biggest wins are:

  • the pipe operator makes transformation code easier to read
  • the URI extension improves URL handling
  • clone with makes immutable objects easier
  • #[\NoDiscard] helps prevent ignored return values
  • array_first() and array_last() reduce boilerplate
  • fatal error backtraces improve debugging
  • new configuration and error handler tools improve developer experience

Overall, PHP 8.5 continues the modern PHP direction: cleaner syntax, safer code, better tooling, and improved maintainability.

For everyday web developers, this is another solid step forward.