Download the PHP package atomino/util-attr without Composer
On this page you can find all versions of the php package atomino/util-attr. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download atomino/util-attr
More information about atomino/util-attr
Files in atomino/util-attr
Package util-attr
Short Description PHP Attribute handler
License MIT
Informations about the package util-attr
Attribute utility
Work easily with PHP8 Attributes!
Create Attributes
Create the Attribute
class as usual, just extend it from the \Atomino\Neutrons\Attr
class.
Add the attribute to a class or a method
Query Single Attribute (get
)
As a return value you will get an Attribute instance or null
Reflection based query
Then get the attribute based on the reflection of the class or method. The IDE will know what type of attribute you requested, the code completion will work.
Name based query
If you don't want to use reflection, you can get the attribute by the class (and the method) name.
Query Repeatable Attribute (all
)
As a return value you will get an array with the Attribute instances in it
Reflection based query
Then get the array of attributes based on the reflection of the class or method. The IDE will know what type of attribute you requested, the code completion will work.
Name based query
If you don't want to use reflection, you can get the attributes by the class (and the method) name.
Query attributes of multiple reflections (collect
)
As a return value you will get an array with the Attribute instances in it
If you want to retrieve the attributes of multiple classes or methods in bulk, you can do so using the collect
method.