Class Attributes
PHP Class with Class Attributes
<?php
declare(strict_types=1);
#[TestAttribute11(["key1" => "key1 value"])]
#[TestAttribute12(10.13)]
#[TestAttribute13(123)]
#[TestAttribute14()]
#[TestAttribute15(["value1", "value2"])]
class Abc
{
// rest of the codes
}Initialize the Attributes Reader
<?php
declare(strict_types=1);
use \AntonDPerera\PHPAttributesReader\AttributesReader;
$class = Abc::class;
$attributes_reader = AttributesReader($class);Available functions for Class Attributes
Returns true or false based on availability of Class attributes.
Returns array of attributes. Each item on Array will be an instance of Attribute class
Refer Attribute class Reference documentation for more details.
Throws
ClassAttributeNotFoundExceptionwhen the given attribute name is not available as a Class Attribute.\AntonDPerera\PHPAttributesReader\Exceptions\ClassAttributeNotFoundExceptionReturns an instance of
Attributeif there is a Class attribute with the given name.\AntonDPerera\PHPAttributesReader\Attribute
Last updated