---
title: "Readonly classes in PHP 8.2"
url: https://daily.dev/posts/readonly-classes-in-php-8-2-2nvnbfjsh
source_url: https://stitcher.io/blog/readonly-classes-in-php-82
type: article
source: "stitcher.io"
published: 2022-10-25T10:02:02.366Z
updated: 2022-10-25T10:02:02.160Z
tags: ["php"]
reading_time: 2
upvotes: 12
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Readonly classes in PHP 8.2

**[stitcher.io](https://daily.dev/sources/stitcher)** · 2 min read · 12 upvotes · 0 comments

## Summary

PHP 8.2 adds a new way of declaring classes: you can make them readonly. In practice, it means that all properties of that class will be readonly. This is especially useful when you're using data transfer objects or value objects, where a class only has public readonly properties.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://stitcher.io/blog/readonly-classes-in-php-82>

## Similar posts on daily.dev

- [Don’t just attend KubeCon \+ CloudNativeCon, Merge Forward your experience\!](https://daily.dev/posts/don-t-just-attend-kubecon-cloudnativecon-merge-forward-your-experience--l0rpp73x8) · CNCF · 0 upvotes · 0 comments
- [Announcing H2 2026 KCDs](https://daily.dev/posts/announcing-h2-2026-kcds-m96goajm1) · CNCF · 1 upvotes · 0 comments
- [Two months of Open Community Groups](https://daily.dev/posts/two-months-of-open-community-groups-asf52zhbs) · CNCF · 0 upvotes · 0 comments

---

Tags: [#php](https://daily.dev/tags/php)

[View this post on daily.dev](https://daily.dev/posts/readonly-classes-in-php-8-2-2nvnbfjsh)
