lee-to / fast-attributes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fast Attributes

Usage

// All class attributes
$classAttributes = Attributes::for(ClassWithAttributes::class)->get();
// Only SomeAttribute class attributes
$someAttributes = Attributes::for(ClassWithAttributes::class)
    ->attribute(SomeAttribute::class)
    ->get();
// Only SomeAttribute instance
$someAttribute = Attributes::for(ClassWithAttributes::class)
    ->attribute(SomeAttribute::class)
    ->first();
// SomeAttribute variable property
$someAttribute = Attributes::for(ClassWithAttributes::class)
    ->attribute(SomeAttribute::class)
    ->first('variable');
// Method parameter attributes
$someAttribute = Attributes::for(ClassWithAttributes::class)
    ->method('someMethod')
    ->parameter('variable')
    ->get();
$someAttribute = Attributes::for(ClassWithAttributes::class)
    ->constant('VARIABLE')
    ->property('variable')
    ->method('someMethod')
    ->parameter('variable')
    ->get();

About

License:MIT License


Languages

Language:PHP 100.0%