Skip to content

FoehnModern WordPress Development

Attribute-based auto-discovery for hooks, post types, blocks, and more

Quick Example

php
<?php
// app/Hooks/ThemeHooks.php

namespace App\Hooks;

use Studiometa\Foehn\Attributes\AsAction;
use Studiometa\Foehn\Attributes\AsFilter;

final class ThemeHooks
{
    #[AsAction('after_setup_theme')]
    public function setupTheme(): void
    {
        add_theme_support('post-thumbnails');
        add_theme_support('title-tag');
    }

    #[AsFilter('excerpt_length')]
    public function excerptLength(): int
    {
        return 30;
    }
}

Acknowledgements

Foehn stands on the shoulders of giants. We're grateful to the following projects and their maintainers:

Core Dependencies

  • Tempest Framework by Brent Roose — The discovery-first PHP framework that powers Foehn's attribute-based auto-discovery and dependency injection
  • Timber by Upstatement — The incredible library that brings Twig templating to WordPress

Inspirations

  • Acorn by Roots — Pioneered Laravel-style development in WordPress and inspired our approach to modern WordPress DX
  • Symfony — The #[AsEventListener] and other attributes inspired our hook registration syntax

Tools

  • ACF Builder by StoutLogic — Fluent PHP API for defining ACF fields
  • Pest — Elegant testing framework used for our test suite
  • Mago — PHP toolchain for linting and formatting

Released under the MIT License.