Skip to content

API Reference

This section documents all attributes, interfaces, and core classes in Foehn.

Attributes

Attributes are PHP 8 annotations that enable auto-discovery and registration of WordPress components.

Hooks

AttributeDescription
#[AsAction]Register a WordPress action hook
#[AsFilter]Register a WordPress filter hook
#[AsShortcode]Register a shortcode handler

Content Types

AttributeDescription
#[AsPostType]Register a custom post type
#[AsTaxonomy]Register a custom taxonomy
#[AsTimberModel]Map Timber class without type registration

Views

AttributeDescription
#[AsViewComposer]Add data to specific templates
#[AsTemplateController]Handle template rendering

Blocks

AttributeDescription
#[AsBlock]Register a native Gutenberg block
#[AsAcfBlock]Register an ACF block
#[AsBlockPattern]Register a block pattern
#[AsBlockCategory]Register a block category

API & CLI

AttributeDescription
#[AsRestRoute]Register a REST API endpoint
#[AsCliCommand]Register a WP-CLI command

Interfaces

Interfaces define contracts for classes used with specific attributes.

InterfaceUsed with
BlockInterface#[AsBlock]
InteractiveBlockInterface#[AsBlock] with interactivity
AcfBlockInterface#[AsAcfBlock]
ViewComposerInterface#[AsViewComposer]
TemplateControllerInterface#[AsTemplateController]
BlockPatternInterface#[AsBlockPattern] (optional)

Core

ClassDescription
KernelMain bootstrap class
HelpersGlobal helper functions

Released under the MIT License.