Skip to content

API Reference

This section documents all attributes, interfaces, and core classes in Føhn.

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
#[AsMenu]Register a navigation menu location
#[AsTimberModel]Map Timber class without type registration

Media

AttributeDescription
#[AsImageSize]Register a custom image size

Views

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

Twig

AttributeDescription
#[AsTwigExtension]Register a Twig extension

Blocks

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

ACF

AttributeDescription
#[AsAcfOptionsPage]Register an ACF options page

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]
AcfFieldGroupInterface#[AsAcfFieldGroup]
AcfOptionsPageInterface#[AsAcfOptionsPage] (optional)
ContextProviderInterface#[AsContextProvider]
TemplateControllerInterface#[AsTemplateController]
BlockPatternInterface#[AsBlockPattern] (optional)

Configuration

Config ClassConfig FileDescription
FoehnConfigapp/foehn.config.phpCore bootstrap settings
TimberConfigapp/timber.config.phpTemplate directories
AcfConfigapp/acf.config.phpACF field transformation
RestConfigapp/rest.config.phpREST API permissions
RenderApiConfigapp/render-api.config.phpRender API allowlisting

Discovery

ClassDescription
DiscoveryRunnerOrchestrates discovery lifecycle
WpDiscoveryDiscovery interface + items/traits
ViewEngineInterfaceView rendering abstraction

Core

ClassDescription
KernelMain bootstrap class
HelpersGlobal helper functions
CacheInterfaceInjectable cache service
WebpackManifestAsset manifest helper

DTOs & Traits

Class / TraitDescription
ArrayableInterface for DTO → array conversion
HasToArrayReflection-based toArray() trait
LinkDataDTO for link/button fields
ImageDataDTO for image/attachment fields
SpacingDataDTO for spacing fields

Query

ClassDescription
PostQueryBuilderFluent post query builder
QueriesPostTypeTrait for model query methods

Released under the MIT License.