DynamicComponent
class DynamicComponent extends Component
Properties
| protected array | $except | The properties / methods that should not be exposed to the component. |
from Component |
| string|null | $componentName | The component alias name. |
from Component |
| ComponentAttributeBag|null | $attributes | The component attributes. |
from Component |
| static protected Factory|null | $factory | The view factory instance, if any. |
from Component |
| static protected null|Closure(string, array): static | $componentsResolver | The component resolver callback. |
from Component |
| static protected array<string, string> | $bladeViewCache | The cache of blade view names, keyed by contents. |
from Component |
| static protected array | $propertyCache | The cache of public property names, keyed by class. |
from Component |
| static protected array | $methodCache | The cache of public method names, keyed by class. |
from Component |
| static protected array<class-string, array<int, string>> | $constructorParametersCache | The cache of constructor parameters, keyed by class. |
from Component |
| static protected array | $ignoredParameterNames | The cache of ignored parameter names. |
from Component |
| string | $component | The name of the component. |
|
| static protected ComponentTagCompiler|null | $compiler | The component tag compiler instance. |
|
| static protected array | $componentClasses | The cached component classes. |
Methods
Resolve the component instance with the given data.
Extract the constructor parameters for the component.
Resolve the Blade view or view file that should be used when rendering the component.
Resolve and cache the Blade view for the given component string.
Get the cache key for the given Blade view contents.
Create a Blade view with the raw component string content.
Create a callable variable from the given method.
Create an invokable, toStringable variable for the given component method.
Determine if the given property / method should be ignored.
Set the extra attributes that the component should make available.
Get a new attribute bag instance.
Get the evaluated view contents for the given view.
Get the cached set of anonymous component constructor parameter names to exclude.
Forget the cached Blade view name for the given contents.
Set the callback that should be used to resolve components within views.
Flush all static state.
Create a new component instance.
Compile the @props directive for the component.
Compile the bindings for the component.
Compile the slots for the component.
Get the class for the current component.
Get the names of the variables that should be bound to the component.
Get an instance of the Blade tag compiler.
Details
at line 44
View|Htmlable|Closure|string
render()
Get the view / contents that represent the component.
in
Component at line 87
static Component
resolve(array $data)
Resolve the component instance with the given data.
in
Component at line 109
static protected array
extractConstructorParameters()
Extract the constructor parameters for the component.
in
Component at line 127
View|Htmlable|Closure|string
resolveView()
Resolve the Blade view or view file that should be used when rendering the component.
in
Component at line 156
protected string
extractBladeViewFromString(string $contents)
Resolve and cache the Blade view for the given component string.
in
Component at line 174
static protected string
bladeViewCacheKey(string $contents)
Get the cache key for the given Blade view contents.
in
Component at line 182
protected string
createBladeViewFromString(Factory $factory, string $contents)
Create a Blade view with the raw component string content.
in
Component at line 202
array
data()
Get the data that should be supplied to the view.
in
Component at line 212
protected array
extractPublicProperties()
Extract the public properties for the component.
in
Component at line 237
protected array
extractPublicMethods()
Extract the public methods for the component.
in
Component at line 261
protected mixed
createVariableFromMethod(ReflectionMethod $method)
Create a callable variable from the given method.
in
Component at line 271
protected InvokableComponentVariable
createInvokableVariable(string $method)
Create an invokable, toStringable variable for the given component method.
in
Component at line 281
protected bool
shouldIgnore(string $name)
Determine if the given property / method should be ignored.
in
Component at line 290
protected array
ignoredMethods()
Get the methods that should be ignored.
in
Component at line 324
Component
withAttributes(array $attributes)
Set the extra attributes that the component should make available.
in
Component at line 336
protected ComponentAttributeBag
newAttributeBag(array $attributes = [])
Get a new attribute bag instance.
in
Component at line 344
bool
shouldRender()
Determine if the component should be rendered.
in
Component at line 352
View
view(string|null $view, Arrayable|array $data = [], array $mergeData = [])
Get the evaluated view contents for the given view.
in
Component at line 372
static array
ignoredParameterNames()
Get the cached set of anonymous component constructor parameter names to exclude.
in
Component at line 398
static void
flushCache()
Flush the component's cached state.
Boot or tests only when called directly. Clears the worker-wide reflection and view caches shared by every coroutine; next render rebuilds them. The view:clear command owns runtime invalidation.
in
Component at line 412
static void
forgetBladeView(string $contents)
| internal |
Forget the cached Blade view name for the given contents.
in
Component at line 423
static void
forgetFactory()
Forget the component's factory instance.
Boot or tests only. Clears the worker-wide ViewFactory reference shared by every coroutine; next render re-resolves it from the container.
in
Component at line 436
static void
forgetComponentsResolver()
| internal |
Forget the component's resolver callback.
Boot or tests only. Clears the worker-wide resolver shared by every coroutine; next component resolution falls back to default behavior.
in
Component at line 451
static void
resolveComponentsUsing(Closure $resolver)
| internal |
Set the callback that should be used to resolve components within views.
Boot-only. The resolver persists in a static property for the worker lifetime and runs on every subsequent component resolution.
at line 155
static void
flushState()
Flush all static state.
at line 36
__construct(BackedEnum|string $component)
Create a new component instance.
at line 83
protected string
compileProps(array $bindings)
Compile the @props directive for the component.
at line 97
protected string
compileBindings(array $bindings)
Compile the bindings for the component.
at line 107
protected string
compileSlots(array $slots)
Compile the slots for the component.
at line 118
protected string
classForComponent()
Get the class for the current component.
at line 127
protected array
bindings(string $class)
Get the names of the variables that should be bound to the component.
at line 137
protected ComponentTagCompiler
compiler()
Get an instance of the Blade tag compiler.