Skip to main content
Article

PHP 8.3 in Production: What to Know Before You Upgrade

2 min read 2 views

PHP 8.3 is one of the most developer-friendly releases in years, but upgrading a production application requires planning. This article walks you through the most impactful changes and how to assess readiness before you flip the switch.

What's New in PHP 8.3

PHP 8.3 introduced several improvements that are particularly useful for web applications built on frameworks like Yii2 or Laravel:

Typed Class Constants

You can now declare the type of a class constant explicitly:

class Status {
    const string ACTIVE   = 'active';
    const string INACTIVE = 'inactive';
}

This catches assignment bugs at compile time rather than runtime, which is especially valuable in large codebases with many collaborators.

Readonly Properties Can Now Be Reinitialised via Clone

PHP 8.3 allows readonly properties to be re-initialised during object cloning. This makes immutable value-object patterns significantly cleaner without the boilerplate workarounds previously required.

json_validate()

A long-requested function that validates a JSON string without decoding it:

if (!json_validate($rawWebhookPayload)) {
    throw new InvalidArgumentException('Invalid JSON received from webhook');
}

This is more efficient than json_decode() followed by a null check, particularly in high-throughput API endpoints.

Dynamic Class Constant Fetch

You can now fetch a constant via a dynamic name:

$name = 'STATUS_ACTIVE';
echo MyClass::{$name}; // works in PHP 8.3

Before You Upgrade: A Practical Checklist

  1. Run your test suite on a PHP 8.3 branch — Codeception, PHPUnit, and most major testing tools work unchanged.
  2. Check deprecated functions — use php -d error_reporting=E_ALL -l against your files, or run phpstan at the strictest level.
  3. Review Composer dependencies — run composer update --dry-run and look for packages pinned to <8.3.
  4. Test your Docker image — switch the base image to php:8.3-fpm in your local compose file and run the full stack before touching production.
  5. Monitor error logs for the first 48 hours post-upgrade — PHP deprecation notices can surface in libraries you do not directly control.

Common Issues We Have Seen

At Pinuno Academy we manage several PHP applications on ns1.pinuno.net, all running PHP 8.3. The most common upgrade friction we encountered:

  • Yii2 extensions that used each() (removed in 8.0) — some unmaintained packages still reference it
  • Dynamic property creation warnings — PHP 8.3 still allows this but emits a deprecation notice that can flood logs if your models use __get/__set without explicit property declarations
  • String interpolation with complex expressions — the new strict mode for heredoc expressions surfaced one edge case in a mail template

Conclusion

PHP 8.3 is a solid upgrade worth taking. The new typed constants and json_validate() alone improve code quality and performance in real-world web applications. Give yourself a two-week testing window, lean on your CI pipeline, and the upgrade should be straightforward.

If your team needs support migrating a legacy PHP application, contact Pinuno Academy — we offer professional PHP consultancy and run the PHP Web Development training programme for developers who want to build on a strong modern foundation.

C

Chrystal Akyempon

Founder at Pinuno Academy — practitioner and instructor in web development, enterprise integration, and ICT training in Ghana.

Related Articles