Quick Start

Below are some sample codes with simplest usages:

PHP Class with Class, Method and Property Attributes

<?php

declare(strict_types=1);

#[TestAttribute1('testValue1')]
class Abc
{
    #[TestAttribute2('testValue2')]
    public ?string $test_property_1 = null;

    public ?string $test_property_2 = null;

    #[TestAttribute3('testValue3')]
    public function testMethod1()
    {
        // rest of the codes
    }

    public function testMethod2()
    {
        // rest of the codes
    }

    // rest of the codes
}

Reading those Attributes in Abc class

Last updated