---
title: "PHP Attributes: how to use PHP Attributes and create custom attribute classes – Fast Tips"
url: https://daily.dev/posts/php-attributes-how-to-use-php-attributes-and-create-custom-attribute-classes-fast-tips-rcepezrlc
source_url: https://devdojo.com/inspector/php-attributes-how-to-use-php-attributes-and-create-custom-attribute-classes-fast-tips
type: article
source: "Community Picks"
author: "Valerio Barbera"
published: 2024-08-23T08:55:43.603Z
updated: 2024-11-07T13:00:10.681Z
tags: ["webdev", "php"]
reading_time: 5
upvotes: 98
comments: 1
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.

# PHP Attributes: how to use PHP Attributes and create custom attribute classes – Fast Tips

**[Community Picks](https://daily.dev/sources/community)** · [@valerione](https://daily.dev/valerione) · 5 min read · 98 upvotes · 1 comments

## Summary

PHP attributes, introduced in PHP 8.0, allow developers to add metadata to code declarations such as classes, methods, or properties. These attributes can be programmatically retrieved, helping to create cleaner and more organized code without affecting runtime performance. The post covers built-in attributes like Deprecated, Override, and SuppressWarnings, and provides examples of how to create and use custom attribute classes. Popular PHP frameworks like Symfony and Laravel are starting to adopt attributes to replace annotations, enhancing the efficiency and maintainability of code.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://devdojo.com/inspector/php-attributes-how-to-use-php-attributes-and-create-custom-attribute-classes-fast-tips>

## Community discussion

Top comments from developers on daily.dev.

**@hashmap** · 0 upvotes

> Quick question: since attributes in PHP are only accessible through reflection, don’t you think this could impact performance in larger applications where attributes are frequently used?

## 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
- [CNCF Unveils Schedule for KubeCon \+ CloudNativeCon Europe 2026](https://daily.dev/posts/cncf-unveils-schedule-for-kubecon-cloudnativecon-europe-2026-ikhcoa5cb) · CNCF · 2 upvotes · 0 comments
- [CNCF Debuts KubeCon \+ CloudNativeCon Japan 2026 Schedule](https://daily.dev/posts/cncf-debuts-kubecon-cloudnativecon-japan-2026-schedule-xp5pyudub) · CNCF · 1 upvotes · 0 comments

---

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

[View this post on daily.dev](https://daily.dev/posts/php-attributes-how-to-use-php-attributes-and-create-custom-attribute-classes-fast-tips-rcepezrlc)
