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
#[AsPostMeta]Register a meta key, with a REST schema
#[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
#[AsBlockBinding]Register a block bindings source

ACF ​

AttributeDescription
#[AsAcfOptionsPage]Register an ACF options page

Settings ​

AttributeDescription
#[AsSettingsPage]An admin page on the WordPress Settings API

Jobs & Content ​

AttributeDescription
#[AsCron]A recurring job on an interval or a cron expression, run by Action Scheduler
#[AsJob]The handler of a job queued with dispatch()
#[AsSeeder]Sample content that wp foehn seed writes (SeederInterface, Upsert::post())

API & CLI ​

AttributeDescription
#[AsRestRoute]Register a REST API endpoint
#[AsRewriteRule]Register a rewrite rule, and answer it
#[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)
SeederInterface#[AsSeeder]
ContextProviderInterface#[AsContextProvider]
TemplateControllerInterface#[AsTemplateController]
RewriteHandlerInterface#[AsRewriteRule] (optional)
BlockPatternInterface#[AsBlockPattern] (optional)

Configuration ​

Config ClassConfig FileDescription
FoehnConfigapp/foehn.config.phpCore bootstrap settings
TimberConfigapp/timber.config.phpTemplate directories
AcfConfigapp/acf.config.phpACF field transformation (studiometa/foehn-acf)
RestConfigapp/rest.config.phpREST API permissions
PageCacheConfigapp/page-cache.config.phpFull-page cache
GlideConfigapp/glide.config.phpGlide image driver: library, quality, size grid
QueryFiltersConfigapp/query-filters.config.phpQuery filters of archive pages
DatabaseExportConfigapp/db-export.config.phpTables and rules of wp foehn db:export

See Configuration for how Føhn loads these files.

Discovery ​

ClassDescription
DiscoveryRunnerOrchestrates discovery lifecycle
#[AsDiscovery]Declares a discovery's phase
ViewEngineInterfaceView rendering abstraction

Core ​

ClassDescription
KernelMain bootstrap class
HelpersGlobal helper functions
CacheInterfaceInjectable PSR-16 cache
ViteManifestVite asset manifest helper
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

Føhn is released under the GPL-3.0-or-later license. The starter, the installer and the Vite plugin are MIT.