neontsun / read-attribute
Utils for reading attributes
1.1.0
2025-02-26 09:53 UTC
Requires
- php: ^8.0
Requires (Dev)
- bamarni/composer-bin-plugin: ^1.8.2
- ergebnis/composer-normalize: ^2.45
- phpunit/phpunit: ^9.6
README
#[\Attribute(\Attribute::TARGET_CLASS)] final class CustomAttribute {} #[CustomAttribute] final class Foo { } use Neontsun\ReadAttribute\ReadAttribute; final class Controller { use ReadAttribute; public function __invoke() { $attribute = $this->readClassAttribute(Foo::class, CustomAttribute::class); if ($attribute instanceof CustomAttribute) { // true } } }