The Attribute attribute
(PHP 8)
Introduction
Attributes offer the ability to add structured, machine-readable metadata information on declarations in code: Classes, methods, functions, parameters, properties and class constants can be the target of an attribute. The metadata defined by attributes can then be inspected at runtime using the Reflection APIs. Attributes could therefore be thought of as a configuration language embedded directly into code.
Class synopsis
/* Constants */
/* Properties */
/* Methods */
}Predefined Constants
Properties
- flags
Changelog
| Version | Description |
|---|---|
| 8.5.0 | Added Attribute::TARGET_CONSTANT. |
See Also
Table of Contents
- Attribute::__construct — Construct a new Attribute instance
↑ and ↓ to navigate • Enter to select • Esc to close • / to open