Modern PHP in 2026: What Actually Changed and Why It Matters

PHP 8.5, released in late 2025, is fast, typed, and modern. The engine rewrite and JIT made 8.x several times quicker than 5.6, and union types, enums, and readonly properties catch bugs early. Upgrade, tune opcache and preloading, and the old reputation no longer applies.
Part of the complete web development guide.
On this page
- The performance story is real now
- Type system: the part that actually prevents bugs
- Property hooks, if you’re on 8.4+
- What I’d actually tell someone starting a project today
- Where custom code still earns its keep
- Upgrading an old site without breaking it
- FAQ
- Is PHP still a good choice for a new project in 2026?
- Do I have to upgrade off PHP 7?
- How long does a typical upgrade take?
Most people who still think PHP is a mess are remembering version 5. The language shipped its 8.5 release in late 2025, and the gap between what PHP was and what it is now is genuinely large. If you’re running an older site or deciding what to build on, here’s the honest state of things.
The performance story is real now
Since PHP 7, the engine rewrite (phpng) plus the JIT compiler added in PHP 8.0 changed the baseline. On typical web workloads, PHP 8.x runs several times faster than PHP 5.6 did, and memory use dropped too. That’s not a marketing number. It’s the same hardware doing more requests per second, which is why so many WordPress and Laravel sites got faster just by upgrading, with no code changes.
What matters more day to day is opcache and preloading. If you’re not tuning those, you’re leaving performance on the table.
; php.ini, production
opcache.enable=1
opcache.memory_consumption=256
opcache.max_accelerated_files=20000
opcache.validate_timestamps=0 ; only in prod, restart FPM on deploy
opcache.jit=1255
opcache.jit_buffer_size=128M
; preload a small set of hot classes
opcache.preload=/var/www/app/preload.php
opcache.preload_user=www-data
One gotcha: validate_timestamps=0 means PHP won’t check if files changed. That’s fine when you deploy by restarting PHP-FPM, and a footgun when you edit files in place on the server. Pick one workflow and stick to it.
Type system: the part that actually prevents bugs
PHP’s type system has grown up. Union types (8.0), intersection types (8.1), readonly properties (8.1), enums (8.1), readonly classes (8.2), and typed class constants (8.3) all landed. The practical effect is that you can write code where the types carry their weight and the runtime catches mistakes before your users do.
<?php
declare(strict_types=1);
enum OrderStatus: string {
case Pending = 'pending';
case Paid = 'paid';
case Shipped = 'shipped';
case Refunded = 'refunded';
}
final readonly class Order {
public function __construct(
public int $id,
public int $customerId,
public OrderStatus $status,
public int $totalCents,
) {}
}
function markPaid(Order $order): Order {
if ($order->status !== OrderStatus::Pending) {
throw new LogicException('Only pending orders can be paid.');
}
return new Order(
$order->id,
$order->customerId,
OrderStatus::Paid,
$order->totalCents,
);
}
Notice there’s no setter. You build a new object instead of mutating one. That’s not dogma, it just removes a whole category of “who changed this and when” bugs. If you’re maintaining a codebase that grew up on arrays passed everywhere, you don’t have to rewrite it. You convert the pieces that keep breaking.
Property hooks, if you’re on 8.4+
Property hooks let you attach get/set logic directly to a property, which kills a lot of boilerplate getters and setters.
<?php
class Product {
public string $name {
set (string $value) {
$trimmed = trim($value);
if ($trimmed === '') {
throw new InvalidArgumentException('Name cannot be empty.');
}
$this->name = $trimmed;
}
}
}
You get validation where the data enters, without a separate method call at every call site.
What I’d actually tell someone starting a project today
- Target PHP 8.3 or 8.4. Both are still in security support in 2026. 8.1 and 8.2 are past their active support windows, so plan the move.
- Use Composer properly. Commit
composer.lock, runcomposer install --no-dev --optimize-autoloaderin production, and don’t ship the vendor directory from your laptop. - Pick a framework unless you have a reason not to. Laravel and Symfony both handle routing, auth, queues, and migrations so you don’t rebuild them badly.
- Run static analysis. PHPStan or Psalm at a decent level catches type errors before they hit production. It’s the highest-value hour you’ll spend on an existing codebase.
- Keep dependencies current. The old “we’ll upgrade later” plan is how sites end up on a version that stopped getting security patches three years ago.
Where custom code still earns its keep
Off-the-shelf themes and plugins cover a lot of ground, and for a brochure site that’s often the right call. The problems show up when your business logic doesn’t fit the plugin’s model: pricing rules, integrations with a system that only your industry uses, a checkout that has to talk to a warehouse. That’s when writing your own PHP beats fighting someone else’s abstraction. This is the kind of work I do through custom web development for local businesses, and most of it is less glamorous than it sounds. It’s migrations, cleanup, and making existing code do what the business actually needs.
Upgrading an old site without breaking it
The upgrade path that works is boring:
- Get a staging copy and a database dump you can restore in one command.
- Run the code on the new PHP version and read the deprecation warnings. They tell you exactly what breaks next.
- Fix in small commits. Run your test suite (or write a few smoke tests if you don’t have one) after each one.
- Deploy behind a flag if you can, and watch error logs for the first day.
Eight out of ten “PHP is broken” incidents I see are really a single extension that wasn’t rebuilt for the new version, or a plugin that hasn’t been touched since 2019. Find those first and the rest usually goes smoothly.
FAQ
Is PHP still a good choice for a new project in 2026?
Yes, for most web applications. It’s fast, well supported, has a huge hiring pool, and runs cheaply on shared or VPS hosting. If you need heavy real-time work or a specific ML stack, other tools may fit better.
Do I have to upgrade off PHP 7?
Yes. PHP 7.4 stopped getting security fixes at the end of 2022, so you’re running unpatched software. The upgrade is almost always cheaper than the incident it prevents.
How long does a typical upgrade take?
For a small site on a current CMS, a day or two. For a custom application with old dependencies and no tests, budget a week or more, and expect to replace a couple of abandoned packages along the way.


