neontsun / read-attribute
Utils for reading attributes
Installs: 483
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/neontsun/read-attribute
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 } } }