Cookie

This site uses tracking cookies used for marketing and statistics. Privacy Policy

Contact

PHP 8.6 Is Here: New Features, Deprecations and How to Upgrade Your Laravel App Safely

PHP 8.6 was released on 19 November 2026. Its headline features are partial function application, a new Time\Duration class, the Io\Poll API for scalable I/O, clamp(), a SortDirection enum, and readonly property defaults. It also tightens session security defaults and deprecates several old functions, so test before you upgrade. PHP 8.6 gets active support until 31 December 2028 and security fixes until 31 December 2030.

Chirag Daxini

Chirag Daxini

Publish Date: November 26, 2026

Summarize with AI:

  • ChatGPT
  • Google AI
  • Perplexity
  • Grok
  • Claude

A few weeks before PHP 8.6 was released, I switched a client's Laravel application, one we maintain as part of our Laravel development services, to the release candidate and ran the full test suite. I expected a quiet afternoon and a short list of deprecation notices. Instead, that test run uncovered a bug that had been silently cutting customer exports short for months, and the bug had nothing to do with PHP 8.6 at all.

At Acquaint Softtech, we test every new PHP release against real client projects before we recommend it to anyone. I have managed a lot of these upgrades, and this one changed how I explain them to clients. PHP 8.6 does add genuinely useful features, but its biggest value is that it refuses to stay quiet about things that were already going wrong.

This article is for you if:

  • You run a PHP or Laravel application and want to know what PHP 8.6 changes.
  • You are still on PHP 8.2 or 8.3 and need an upgrade plan before support ends.
  • You want real code examples of the new features, not just a list of names.
  • You need to know which deprecations and breaking changes could affect production.


PHP 8.6 adds partial function application, a Duration class, a modern polling API, clamp(), a SortDirection enum, readonly property defaults, and structured stream errors. It changes some defaults, especially for sessions, and deprecates a set of older functions. Most Laravel apps can move to PHP 8.6 with a planned upgrade, but you should check your dependencies and test session behaviour and file operations first. 

Below, I share what I found, then walk through every feature with code.

Planning a PHP 8.6 upgrade?

Tell us your PHP and Laravel versions and your hosting setup. We will review your Composer dependencies and give you an honest upgrade plan with real effort estimates, in a free 30-minute call.

What a Release Candidate Test Taught Me About PHP 8.6

The application is a subscription platform we maintain for a client. It runs on Laravel and PHP 8.2, has a little over a thousand automated tests, and includes a few older modules that predate the current team. In other words, it looks like most real business applications: mostly modern, with some history underneath.

I created a separate branch, set the CI pipeline to the PHP 8.6 release candidate, and started the test run. Over the next four working days, the upgrade taught me four lessons that I now share with every client.

The first lesson: your lock file breaks before your code does

The very first failure was not a test. composer install refused to run because a PDF generation package two levels deep in our dependencies declared support only up to PHP 8.5. Nothing in its code was incompatible; it was just a version constraint nobody had updated yet. We pointed the test branch at a patched fork and tracked the upstream fix. When you plan an upgrade, check dependencies before you check code.

The second lesson: changed defaults hurt more than deprecations

Almost every test passed. The real problem appeared during manual checks. An old reporting screen, embedded in the client's partner portal through an iframe, still used native PHP sessions instead of Laravel's session system. 

With PHP 8.6 setting session cookies to SameSite=Lax by default, the browser stopped sending that cookie inside the cross-site iframe, and partners were bounced back to a login page. Automated tests did not catch it, because they never run inside another website. We set the cookie options for that module explicitly and added the module to our list for a proper rewrite.

The third lesson: deprecation notices are a to-do list, not noise

The logs are filled with deprecation notices from an old search helper that used mb_split(), plus two utility functions still calling is_integer(). None of this broke anything today, but all of it will break in PHP 9. Replacing them with preg_split() using the u modifier, and with is_int(), took less than an hour. Fixing them during a planned upgrade costs very little; fixing them during an emergency costs a lot more.

The fourth lesson: upgrades reveal bugs you already have

This was the surprise. A nightly job writes a large CSV export to a network drive. On PHP 8.6, the job started failing because file_put_contents() now returns false when flushing the file fails. When I looked into why it was failing, I found that the network share had been running out of space on busy nights. 

On older PHP versions, that failure was silently ignored, so some exports had been cut short for months without anyone noticing. PHP 8.6 did not create this bug. It finally reported it. We added storage monitoring, checked the return value properly, and added a retry.

From the first test run to a clean build took four working days. More importantly, the client ended up with a healthier application than before the upgrade. Keep these four lessons in mind as you read the rest of this guide, because each one maps directly onto a section below.

Why PHP 8.6 Matters Right Now

Every PHP release gets two years of active support and then two years of security fixes only. Once both end, the version reaches end of life and stops receiving security patches. That support calendar is what turns a PHP upgrade from "nice to have" into a business decision.

As of late November 2026, this is the picture according to the official PHP supported versions page:

PHP version

Released

Active support until

Security fixes until

PHP 8.2

8 Dec 2022

Ended

31 Dec 2026 (ends in weeks)

PHP 8.3

23 Nov 2023

Ended

31 Dec 2027

PHP 8.4

21 Nov 2024

31 Dec 2026

31 Dec 2028

PHP 8.5

20 Nov 2025

31 Dec 2027

31 Dec 2029

PHP 8.6

19 Nov 2026

31 Dec 2028

31 Dec 2030

The application in my story was on PHP 8.2, which stops receiving security fixes on 31 December 2026. Running an unsupported PHP version means any new security issue stays open on your servers, which is a real risk for payment, health, and customer data, and a common finding in security audits. Moving straight to PHP 8.6 gives you the longest runway: four full years before the next major move.

What Is PHP 8.6 and How Long Is It Supported?

PHP 8.6 is the annual feature release of the PHP language, published on 19 November 2026. The official PHP 8.6 release announcement describes it as a major update focused on more expressive code, stronger types, and scalable I/O. It receives active support until 31 December 2028 and security fixes until 31 December 2030.

In practical terms, the release has four themes:

  • Cleaner code: partial function application, clamp(), and readonly property defaults remove common boilerplate.

  • Stronger types: Time\Duration and the SortDirection enum replace loose integers that were easy to misuse.

  • Scalable I/O: the new Io\Poll API removes the old connection limits of stream_select().

  • Safer defaults: stricter session settings, structured stream errors, and more ValueError exceptions instead of silent failures.

The 6 Biggest New Features in PHP 8.6

These are the six changes I expect to see most in day-to-day code, each with a before and after example based on the official release notes.

1. Partial function application

Partial function application lets you fill in some of a function's arguments now and leave placeholders for the rest. You use ? for a single missing argument and ... for the remaining ones. The result is a Closure, and the original function only runs once the missing arguments arrive.

Before (PHP 8.5 and older)

$versions = ['8.4', '8.5', '8.6', '8.7', '9.0'];
 
$supportsPfa = array_filter(
    $versions,
    fn (version)=>versioncompare(version, '8.6', '>='),
);

After (PHP 8.6)
$supportsPfa = array_filter(
    $versions,
    version_compare(?, '8.6', '>='),
);

Why it matters: callbacks become shorter and easier to read, and PHP can compile array_map() calls that use them into faster loops. For Laravel teams, expect this to appear quickly in collection pipelines, validation rules, and event listeners.

Why it matters: callbacks become shorter and easier to read, and PHP can compile array_map() calls that use them into faster loops. For Laravel teams, expect this to appear quickly in collection pipelines, validation rules, and event listeners.

2. The new Time\Duration class

Time\Duration represents elapsed time, like a stopwatch, independent of dates and time zones. It covers a range of more than 250 years with nanosecond precision, and Duration objects can be compared directly. It is built for timeouts, retry delays, and benchmark timings.

Before: integers in microseconds, documented only in a comment

// All delays are in microseconds.
function backoff(int $baseDelay, int $step, int $attempt): void
{
    $delay = baseDelay+(step * (2 ** $attempt));
    usleep(min($delay, 30_000_000)); // wait at most 30 seconds
}
 
backoff(1_000_000, 100_000, $attempt);

After: units are part of the type

use Time\Duration;
 
function backoff(Duration $baseDelay, Duration $step, int $attempt): void
{
    $delay = baseDelay->add(step->multiplyBy(2 ** $attempt));
    delay=min(delay, Duration::fromSeconds(30));
 
    time_nanosleep($delay->seconds, $delay->nanoseconds);
}
 
backoff(Duration::fromSeconds(1), Duration::fromMilliseconds(100), $attempt);

Why it matters: a whole class of bugs, such as passing milliseconds where microseconds were expected, simply disappears. In my experience, retry and timeout code is exactly where these mistakes hide, because it rarely runs during normal testing.

3. The Io\Poll API for scalable I/O

The new Io\Poll API watches many streams at once using the best mechanism on each platform: epoll, kqueue, event ports or WSAPoll. It removes the scalability limits of stream_select(), which typically cannot handle more than about 1,024 connections. It is designed as a foundation for event-loop libraries such as ReactPHP and AMPHP.

After (PHP 8.6): a simple echo server

use Io\Poll\{Context, Event};
 
$server = stream_socket_server('tcp://0.0.0.0:8080');
 
$poll = new Context(); // epoll, kqueue, event ports or WSAPoll
poll->add(newStreamPollHandle(server), [Event::Read]);
 
while (true) {
    foreach ($poll->wait() as $watcher) {
        $stream = $watcher->getHandle()->getStream();
        // accept new clients or read and reply as before
    }
}

Why it matters: PHP becomes a more credible choice for long-running servers such as WebSockets, live dashboards, chat and real-time notifications. Most application developers will benefit indirectly, as async libraries adopt the new API.

4. The new clamp() function

clamp() keeps a value inside a range and returns the nearest boundary when the value falls outside it. It works with any comparable value, including the new Duration class.

Before and after

// Before
max(0, min($value, 100));
 
// After
clamp($value, 0, 100);
 
clamp(110, 0, 100); // int(100)
clamp(-10, 0, 100); // int(0)

Why it matters: the old max(min()) pattern is easy to write backwards. clamp() says exactly what it does, which helps with pagination limits, prices, percentages, and user input.

5. The SortDirection enum

SortDirection gives PHP a shared, type-safe way to express sort order, with Ascending and Descending cases. Until now, libraries used a mix of integers, strings, booleans, and custom enums.

After (PHP 8.6)

public function orderBy(
    string $column,
    SortDirection $direction = SortDirection::Ascending,
): static {
    $this->orderBy[] = column.''.match(direction) {
        SortDirection::Ascending => 'ASC',
        SortDirection::Descending => 'DESC',
    };
    return $this;
}
 
$qb->orderBy('name', SORT_STRING);
// TypeError: Argument #2 ($direction) must be of type SortDirection

Why it matters: with the old integer constants, passing SORT_STRING by mistake was accepted by the method signature and only failed deep inside the code. With SortDirection, the mistake is caught immediately, with a clear error.

6. Readonly property defaults

Instance readonly properties, including those in readonly classes, can now declare a default value. The default counts as initialisation, so the constructor cannot overwrite it.

Before and after

// Before: a constructor just to set a fixed value
final readonly class SlugRule implements Rule
{
    public string $parser;
 
    public function __construct()
    {
        $this->parser = SlugParser::class;
    }
}
 
// After
final readonly class SlugRule implements Rule
{
    public string $parser = SlugParser::class;
}

Why it matters: value objects, DTOs, and configuration classes get shorter, and fixed values are visible at a glance instead of being hidden in a constructor.

Other PHP 8.6 Improvements Worth Knowing

Structured stream error handling

Stream operations can now throw a StreamException or fail silently, instead of emitting warnings. Each error is a structured StreamError object with a StreamErrorCode enum case, the wrapper name, and the path or URL. You can also read errors with stream_last_errors(). 

This is the proper replacement for the old @ and error_get_last() pattern, and it is the kind of tool that would have caught the export problem in my story much earlier.

$context = stream_context_create([
    'stream' => ['error_mode' => StreamErrorMode::Exception],
]);
 
try {
    $config = file_get_contents('/etc/app/config.json', context: $context);
} catch (StreamException $e) {
    foreach ($e->getErrors() as $error) {
        log_error($error->code->name, $error->message, $error->wrapperName);
    }
}

DocComments on function parameters

Each parameter can now have its own DocComment, readable through the new ReflectionParameter::getDocComment(). This is useful for API documentation generators, form builders and AI tooling that reads code to describe functions.

ReflectionProperty::isReadable() and isWritable()

These new methods tell you whether a property can be read or written from a given scope, taking visibility, initialisation state, property hooks and magic methods into account. Framework and package authors will use them for serialisers, hydrators and model mapping.

Smaller additions at a glance

Area

What is new

Language

#[\Override] on class constants and enum cases; __debugInfo() on enums; modifying properties of objects stored in constants

URIs

Uri\Rfc3986\UriBuilder and Uri\WhatWg\UrlBuilder classes, plus URI and host type detection

Security

Sodium adds post-quantum key encapsulation (X-Wing, ML-KEM-768), IP address encryption, SHAKE and TurboSHAKE

TLS

Session resumption, external pre-shared keys and TLS 1.3 early data (0-RTT)

Databases

mysqli::quote_string() escapes and quotes a string, matching PDO::quote()

Debugging

JSON errors show the location of the problem; new error_include_args INI setting

Other

grapheme_strrev(), IntlNumberRangeFormatter, in-memory ZipArchive, endianness modifiers in pack()

PHP 8.6 Performance Improvements

PHP 8.6 is not a big performance release in the way PHP 7 was, but it adds several targeted speedups that help typical web applications:

  • array_map() calls with first-class callable or partial application callbacks are compiled into loops.

  • printf() calls are faster.

  • Stateless closures are cached, so they are not rebuilt on every call.

  • JSON encoding is faster, which helps every API endpoint that returns JSON.

My honest advice: do not upgrade for speed alone. Measure your own application before and after, on realistic traffic. The bigger wins in this release are fewer silent bugs and longer support.

PHP 8.6 Deprecations: What to Replace

Deprecations do not break your code today. They raise notices now and are likely to become errors in PHP 9. As the third lesson showed, fixing them during a planned upgrade usually takes hours, not days.

Deprecated in PHP 8.6

Use instead

return inside a finally block

Return from try or catch; finally should only clean up

Returning a value from construct() or destruct()

Remove the return value

mb_ereg(), mb_split() and other mbstring regex functions

preg_* functions with the u modifier

is_double(), is_long(), is_integer(), doubleval()

is_float(), is_int(), floatval()

spl_object_hash()

spl_object_id()

strcoll() and SORT_LOCALE_STRING

The intl Collator class

Passing objects to array_walk() and http_build_query()

Call get_object_vars() first

Session handlers without create_sid() and validateId()

Implement both methods

let or is as class, function or constant names

Rename them

metaphone(), mysqli_get_charset(), mysqli_stmt_init()

Check the migration guide for alternatives

 The full list, including ArrayIterator and SplFileObject methods, is in the official PHP 8.6 migration guide.

Breaking Changes That Can Affect Your App

These are the changes most likely to cause surprises after an upgrade. Two of them, the session defaults and the file function return values, are exactly what I ran into in the story above.

Change

What can break

What to check

Session defaults: strict mode and HttpOnly on, SameSite=Lax

Cross-site logins, SSO callbacks, embedded iframes, JS reading the session cookie

Login flows, payment redirects, third-party embeds

trim(), ltrim(), rtrim() also strip form feed (\f)

Rare, but text parsers that rely on \f

Imports and file parsers

fclose(), file_put_contents(), copy() return false on flush failure

Code that assumed these always succeed

File writes, exports, uploads

More functions throw ValueError

Code that passed invalid flags or NUL bytes silently

Error logs during testing

Laravel sets its own session cookie options in config/session.php, so most Laravel code is less exposed to the session change. The risk sits in older modules, packages or embedded screens that still use native PHP sessions, which is why manual testing matters as much as your automated suite.

Not sure how PHP 8.6 affects your codebase?

Every Acquaint Softtech upgrade starts with a written review of your code and dependencies, listing every deprecation and breaking change that applies, with an effort estimate. NDA signed before we look at any code.

What PHP 8.6 Means for Laravel Applications

Laravel has always moved quickly to support new PHP features, and PHP 8.6 gives Laravel teams several practical improvements once your framework version and packages support it. If you are new to the framework, our guide on why businesses use Laravel in 2026 covers the bigger picture.

Cleaner collection pipelines

Partial function application fits naturally with Laravel collections. Callbacks such as filter(), map() and reject() that only exist to fix one argument become shorter and easier to scan.

Safer queue retries and timeouts

Queue backoff, HTTP client timeouts, and rate limits all deal with time. Using Duration in your own services makes units explicit, which removes a common source of production bugs in retry logic.

Leaner DTOs and value objects

Readonly property defaults suit Laravel data objects, action classes, and form request DTOs, where many values are fixed. Fewer constructors means less code to review.

Better real-time foundations

The Io\Poll API strengthens the base that PHP WebSocket servers and async libraries build on. For products with live dashboards, chat, or notifications, that is good long-term news.

A better base for AI features

Parameter DocComments and the new reflection methods make it easier for tools to understand code automatically, and structured stream errors make calls to external AI APIs easier to handle cleanly. If you are adding AI to your product, the Laravel AI development team at Acquaint Softtech builds chatbots, document processing, and AI agents on top of these foundations.

How to Upgrade to PHP 8.6 Safely

A PHP upgrade is low risk when it is planned and high risk when it is rushed. This is the process I follow with my team, shaped by projects like the one in my story.

  1. Check your framework and packages first. Run composer why-not php 8.6 to see which dependencies do not yet declare PHP 8.6 support. As my first lesson showed, a fixed PHP range in a package's composer.json is the most common blocker.

  2. Upgrade Laravel if needed. If your Laravel version does not support PHP 8.6, upgrade the framework first. Our Laravel upgrade guide, linked in the related reading below, explains how to move between versions safely.

  3. Run static analysis. Tools such as PHPStan or Rector, set to PHP 8.6 rules, find deprecated functions and many breaking changes before you run a single test.

  4. Test on PHP 8.6 in CI. Add PHP 8.6 to your test matrix alongside your current version, and fix deprecation notices as you go.

  5. Test sessions and file operations by hand. Log in, log out, complete a payment redirect, open any embedded screens, and run your scheduled exports and uploads. This is where automated tests most often miss problems.

  6. Deploy to staging, then production. Watch error logs and response times closely for the first days, with a tested rollback plan ready.

For a typical Laravel application already on a supported framework version, this usually takes days rather than weeks, just like the four working days in my story. Older applications that also need a framework upgrade take longer, and the cost depends mainly on test coverage and the number of outdated packages. Our guide to Laravel development cost explains how this kind of work is usually priced.

Should You Upgrade Now or Wait?

There is no single right answer. It depends on where you are today.

If your situation is

My advice

Why

On PHP 8.2

Plan the upgrade now

Security fixes end on 31 December 2026

On PHP 8.3

Upgrade during 2027

Security fixes continue until the end of 2027

On PHP 8.4 or 8.5

Upgrade when your packages support 8.6

You are still fully supported

Starting a new project

Start on PHP 8.6 if your stack supports it

Longest support window, newest features

Large app with low test coverage

Add tests first, then upgrade

Tests make the upgrade safe and repeatable

A sensible pattern is to wait a few weeks after a release for the ecosystem to catch up, then upgrade in a planned sprint. Just do not wait so long that a security deadline decides for you.

Upgrade to PHP 8.6 With Acquaint Softtech

PHP and Laravel upgrades are routine work for my team. As an Official Laravel Partner with 70+ in-house engineers, Acquaint Softtech supports startups, SMEs and enterprises across the US, UK, Europe and Australia, from version upgrades and maintenance to full product builds.

What makes us stand out

  • Full-time, in-house Laravel engineers, not marketplace freelancers.

  • Upgrade reviews that list every deprecation and breaking change before work starts.

  • NDA before any discussion, and 100% IP ownership from day one.

  • Engineers can join your standups within 48 hours.

  • ISO 27001-certified delivery and a 4.9/5 average client rating.

Ways to work with us

Need extra hands inside your own team? Use IT staff augmentation to add vetted Laravel engineers who work in your tools and processes. Prefer a dedicated offshore team? Our page on how to hire offshore Laravel developers covers overlap hours, IP protection, and engagement models. UK teams can hire dedicated Laravel developers in the UK with pricing in pounds and GMT-friendly delivery.

That release candidate test started as a routine check and ended with a client application that was safer than before. That is what I want every team to take from PHP 8.6: test early, read every notice, and treat the upgrade as a health check, not a chore. If you would like Acquaint Softtech to run that health check for you, we are ready when you are.

Ready to move to PHP 8.6?

Tell us your PHP version, Laravel version, and timeline. We will share vetted Laravel profiles within 24 hours, and your developer can start within 48 hours.

Frequently Asked Questions

  • When was PHP 8.6 released?

    PHP 8.6 was released on 19 November 2026. It gets active support until 31 December 2028 and security fixes until 31 December 2030.

  • What are the main new features in PHP 8.6?

    The headline features are partial function application, the Time\Duration class, the Io\Poll API, the clamp() function, the SortDirection enum, readonly property defaults, and structured stream error handling.

  • What is partial function application in PHP 8.6?

    It lets you supply some of a function's arguments in advance and use ? or ... placeholders for the rest. PHP returns a Closure, and the function runs once the remaining arguments are passed.

  • Is PHP 8.6 backward compatible?

    Mostly, but not completely. Session security defaults are stricter, some file functions now report failures, and more functions throw ValueError for invalid input. Test login flows, embedded screens, and file operations before upgrading.

  • Can I use PHP 8.6 with Laravel?

    Yes, once your Laravel version and every package in your composer.lock declare PHP 8.6 support. Run composer why-not php 8.6 to find blockers, and upgrade the framework first if needed.

  • Should I upgrade from PHP 8.2 now?

    Yes. PHP 8.2 stops receiving security fixes on 31 December 2026. Moving straight to PHP 8.6 gives you the longest support window.

Chirag Daxini

With over 11 years of experience in web application development and project management, I excel in leading cross-functional teams to deliver innovative digital solutions. My expertise spans eCommerce platforms, ERP systems, and JS & PHP-based frameworks, including WordPress, React JS, and Laravel. As a Technical Project Manager, I specialize in strategic planning, system design, and end-to-end project execution, transforming complex ideas into scalable, high-impact applications.

Get Started with Acquaint Softtech

  • 13+ Years Delivering Software Excellence
  • 1300+ Projects Delivered With Precision
  • Official Laravel & Laravel News Partner
  • Official Statamic Partner

Related Blog

Laravel Upgrade Guide: Moving From Laravel 9-12 to Laravel 13 Safely

The latest Laravel version is Laravel 13, released on 17 March 2026, and it requires PHP 8.3 or higher. To update safely, upgrade one major version at a time (for example 11 to 12, then 12 to 13), test in staging at every step, and fix package conflicts before you deploy.

Acquaint Softtech

Acquaint Softtech

July 29, 2025

Why Use Laravel in 2027? Benefits, Ecosystem and Built-In AI Tooling

Use Laravel because it is a secure, high-performance, open-source PHP framework that helps teams build faster and scale safely. It has a huge community, a rich official ecosystem, yearly releases with clear support windows, and, since 2027, first-party AI tooling for AI features and agents.

Acquaint Softtech

Acquaint Softtech

March 29, 2023

Laravel Development Cost in 2027: Hourly Rates, Project Pricing and AI Feature Costs

Laravel development usually costs $8,000 to $22,000 for an MVP, $20,000 to $65,000 for a SaaS app, and $40,000 to $100,000+ for regulated platforms. Laravel developers charge about $22 to $55 an hour in India and $100 to $180 an hour in the US. Adding AI features typically adds $10,000 to $30,000.

Mukesh Ram

Mukesh Ram

January 23, 2025

India (Head Office)

203/204, Shapath-II, Near Silver Leaf Hotel, Opp. Rajpath Club, SG Highway, Ahmedabad-380054, Gujarat

USA

7838 Camino Cielo St, Highland, CA 92346

UK

The Powerhouse, 21 Woodthorpe Road, Ashford, England, TW15 2RP

New Zealand

42 Exler Place, Avondale, Auckland 0600, New Zealand

Canada

141 Skyview Bay NE , Calgary, Alberta, T3N 2K6

Subscribe to new posts