Facades

The package ships several Laravel facades. All are bound in TextstemServiceProvider and aliased in config/app.php (or via the package's alias registration).

Textstem Facade

Accessor: textstem -- wraps Medialight\Textstem\Textstem.

The primary package facade. Provides page context, global options, and HTML rendering shortcuts.

Alias: Textstem (registered automatically by the service provider)

Key methods:

Method Description
getPage() Returns the current WranglerPage instance set in context.
setPage($page) Sets the active page for the current request context.
globalVal(string $key) Gets the value of a GlobalOption by key.
globalVar(string $key) Alias for globalVal.
sectionMenu(string $section) Returns a navigation menu for the given section slug.
section(string $name) Returns the named section/region of the current page.
pageCategoryList() Returns a list of page categories.
asset(int $id) Loads and returns an Asset model by ID.
nicefy(string $str) Converts a slug or technical string into a human-readable label.
wrt(string $key) Returns a translated string from the package language files.
picture($asset, array $attrs) Renders a responsive <picture> element for an asset.
image($asset, array $attrs) Renders an <img> element for an asset.
thumbImg($asset, array $attrs) Renders a thumbnail <img> element for an asset.
assetTile($asset, array $attrs) Renders an asset tile component.
findHelperClass(string $name) Resolves a helper class by short name.
sendMsg(array $data) Sends an internal message/notification.

Preferences Facade

Accessor: preferences -- wraps Medialight\Textstem\Preferences.

Manages per-user or global preference key/value pairs stored as JSON in the local storage disk.

Alias: Preferences (registered automatically)

Method Description
get(string $key, mixed $default = null) Gets a preference value by key.
all(): array Returns all stored preferences.
set(string $key, mixed $value) Sets a single preference value.
update(array $values) Merges an array of key/value pairs into the stored preferences.
save() Persists the current in-memory preferences to disk.
reset() Clears all preferences and resets to defaults.
validateConfig(array $config): bool Validates a preferences configuration array.

Preferences are stored at storage/app/preferences.json on the local disk.

Notifier Facade

Accessor: messenger -- wraps the Messenger tool/service.

Alias: Notifier (registered automatically via NotifierFacade)

Used to send in-app notifications or messages. The binding resolves to the Messenger service registered in the container.

Accessibility Facade

Accessor: accessibility -- wraps Medialight\Textstem\Services\AccessibilityService.

Alias: Accessibility

Runs WCAG accessibility analysis against URLs or raw HTML.

Method Description
analyzeUrl(string $url): array Fetches the URL and analyses its HTML for accessibility issues.
analyzeHtml(string $html): array Analyses a raw HTML string for accessibility issues.
getWcagLevel(): string Returns the configured WCAG conformance level (A, AA, or AAA).
shouldCheckOnSave(): bool Returns true if analysis should run automatically on page save.
shouldStoreReports(): bool Returns true if analysis reports should be persisted.
getReportRetentionDays(): int Returns how many days reports are retained before being pruned.

Configuration is read from textstemapp.accessibility.*.

SEO Facade

Accessor: seo -- wraps Medialight\Textstem\Services\SEOService.

Alias: SEO

Runs SEO analysis against URLs or raw HTML.

Method Description
analyzeUrl(string $url): array Fetches the URL and analyses its HTML for SEO issues.
analyzeHtml(string $html): array Analyses a raw HTML string for SEO issues.
shouldCheckOnSave(): bool Returns true if analysis should run automatically on page save.
shouldStoreReports(): bool Returns true if SEO reports should be persisted.
getReportRetentionDays(): int Returns how many days SEO reports are retained.

Configuration is read from textstemapp.seo.*.

TableGenerator Facade

Accessor: tablegenerator -- wraps Medialight\Textstem\Services\TableGeneratorService.

Alias: TableGenerator (registered via TableGeneratorFacade)

Generates HTML tables from PHP arrays using Tailwind CSS classes.

Method Description
arrayToTable(array $array): string Converts a 2-D array to a full <table> HTML string including header row.
rowToHead(array $row): string Generates a <thead> row from the keys of the supplied array.
rowToHtml(array $row): string Generates a <tr> row from the values of the supplied array.

Example:

TableGenerator::arrayToTable([
    ['Name' => 'Alice', 'Role' => 'Admin'],
    ['Name' => 'Bob',   'Role' => 'Editor'],
]);
esc