Darken\Attributes\Slot

class

An attribute that marks a property as a “slot,” which can be used to inject or map data from an external source (e.g., templates, components, or any slot-based mechanism). If a custom $name is provided, that will be used as the slot identifier. If $name is omitted or null, the property’s own name is used as the slot identifier.

Example usage:

#[Slot('header')]
public string $headerContent;

// This property will be linked to the slot named 'header'.
// If 'headerContent' is not your desired slot name, you can explicitly
// set it by providing 'header' here.

#[Slot]
public string $footer;

// If $name is omitted, 'footer' is used as the slot identifier by default.

Methods

Method Details

public __construct (?string $name) Slot.php#38
$name ?string