forxer / blade-components-reflection
Runtime reflection utilities for class-based Blade components (settable attributes & constructor parameters).
Package info
github.com/forxer/blade-components-reflection
pkg:composer/forxer/blade-components-reflection
Requires
- php: ^8.4
- illuminate/support: ^12.0 || ^13.0
- illuminate/view: ^12.0 || ^13.0
Requires (Dev)
- driftingly/rector-laravel: ^2.5.0
- laravel/pint: ^1.29.3
- pestphp/pest: ^3
- rector/rector: ^2.5.2
This package is auto-updated.
Last update: 2026-07-02 11:05:09 UTC
README
Runtime reflection utilities for class-based Blade components. Given a component class, it reports the attributes a Blade tag can set on it:
AttributeReflector::settableProperties($class)— public, non-promoted, externally-settable properties (excludes static, promoted,private(set)/protected(set), andIlluminate\View\Componentinternals), kebab-cased.AttributeReflector::constructorParameters($class)— every constructor parameter, with arequiredflag.
It is a small, provider-less library (no service provider, no config). Consumers that hydrate public
properties from the Blade attribute bag at render time use it directly; the companion dev tool
forxer/blade-components-ide-helper
uses the same class to generate IDE metadata.
Installation
composer require forxer/blade-components-reflection
Usage
use Forxer\BladeComponentsReflection\AttributeReflector; $properties = AttributeReflector::settableProperties(MyComponent::class); // [['name' => 'variant', 'kebab' => 'variant', 'type' => 'string'], ...] $parameters = AttributeReflector::constructorParameters(MyComponent::class); // [['name' => 'label', 'kebab' => 'label', 'type' => 'string', 'required' => true], ...]
License
MIT