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
| Attribute | Description |
|---|---|
#[AsAction] | Register a WordPress action hook |
#[AsFilter] | Register a WordPress filter hook |
#[AsShortcode] | Register a shortcode handler |
Content Types
| Attribute | Description |
|---|---|
#[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
| Attribute | Description |
|---|---|
#[AsImageSize] | Register a custom image size |
Views
| Attribute | Description |
|---|---|
#[AsContextProvider] | Add data to specific templates |
#[AsTemplateController] | Handle template rendering |
Twig
| Attribute | Description |
|---|---|
#[AsTwigExtension] | Register a Twig extension |
Blocks
| Attribute | Description |
|---|---|
#[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
| Attribute | Description |
|---|---|
#[AsAcfOptionsPage] | Register an ACF options page |
API & CLI
| Attribute | Description |
|---|---|
#[AsRestRoute] | Register a REST API endpoint |
#[AsCliCommand] | Register a WP-CLI command |
Interfaces
Interfaces define contracts for classes used with specific attributes.
| Interface | Used with |
|---|---|
BlockInterface | #[AsBlock] |
InteractiveBlockInterface | #[AsBlock] with interactivity |
AcfBlockInterface | #[AsAcfBlock] |
AcfFieldGroupInterface | #[AsAcfFieldGroup] |
AcfOptionsPageInterface | #[AsAcfOptionsPage] (optional) |
ContextProviderInterface | #[AsContextProvider] |
TemplateControllerInterface | #[AsTemplateController] |
BlockPatternInterface | #[AsBlockPattern] (optional) |
Configuration
| Config Class | Config File | Description |
|---|---|---|
FoehnConfig | app/foehn.config.php | Core bootstrap settings |
TimberConfig | app/timber.config.php | Template directories |
AcfConfig | app/acf.config.php | ACF field transformation |
RestConfig | app/rest.config.php | REST API permissions |
RenderApiConfig | app/render-api.config.php | Render API allowlisting |
Discovery
| Class | Description |
|---|---|
DiscoveryRunner | Orchestrates discovery lifecycle |
WpDiscovery | Discovery interface + items/traits |
ViewEngineInterface | View rendering abstraction |
Core
| Class | Description |
|---|---|
Kernel | Main bootstrap class |
Helpers | Global helper functions |
CacheInterface | Injectable cache service |
WebpackManifest | Asset manifest helper |
DTOs & Traits
| Class / Trait | Description |
|---|---|
Arrayable | Interface for DTO → array conversion |
HasToArray | Reflection-based toArray() trait |
LinkData | DTO for link/button fields |
ImageData | DTO for image/attachment fields |
SpacingData | DTO for spacing fields |
Query
| Class | Description |
|---|---|
PostQueryBuilder | Fluent post query builder |
QueriesPostType | Trait for model query methods |