PHPackages                             kaiseki/wp-two-stage-font-loader - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. kaiseki/wp-two-stage-font-loader

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

kaiseki/wp-two-stage-font-loader
================================

Two-stage web font loading for WordPress: render @font-face CSS and preload links, toggling stage classes as fonts load

1.0.0(1mo ago)0130MITPHPPHP ^8.2CI passing

Since Jun 1Pushed 3w ago2 watchersCompare

[ Source](https://github.com/kaisekidev/kaiseki-wp-two-stage-font-loader)[ Packagist](https://packagist.org/packages/kaiseki/wp-two-stage-font-loader)[ Docs](https://github.com/kaisekidev/kaiseki-wp-two-stage-font-loader)[ RSS](/packages/kaiseki-wp-two-stage-font-loader/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (17)Versions (6)Used By (0)

kaiseki/wp-two-stage-font-loader
================================

[](#kaisekiwp-two-stage-font-loader)

Two-stage web font loading for WordPress: render `@font-face` CSS and preload links, toggling stage classes as fonts load.

Loads critical (stage 1) fonts first and the remaining (stage 2) fonts afterwards, adding a CSS class to `` at each stage so you can avoid layout shift and control the swap. Fonts are configured declaratively and wired through `ConfigProvider` / `kaiseki/wp-hook`.

Installation
------------

[](#installation)

```
composer require kaiseki/wp-two-stage-font-loader
```

Requires PHP 8.2 or newer.

Usage
-----

[](#usage)

Register `ConfigProvider` with your laminas-style config aggregator and configure the `fonts` key. Each font entry is a `FontConfig` — `family` and `src` (a list of font-file URLs) are required, with optional `weight`, `italic` and `style` — consumed by `FontFactory`:

```
use Kaiseki\WordPress\TwoStageFontLoader\FontManager;
use Kaiseki\WordPress\TwoStageFontLoader\Loader\ConfigLoader;

return [
    'fonts' => [
        // Critical fonts — loaded first.
        'stage_1_fonts' => [
            [
                'family' => 'Inter',
                'src'    => ['/fonts/inter-400.woff2', '/fonts/inter-400.woff'],
                'weight' => '400',
                'italic' => false,
            ],
        ],
        // Remaining fonts — loaded after stage 1.
        'stage_2_fonts' => [],
        'stage_1_class' => 'fonts-loaded-stage1',
        'stage_2_class' => 'fonts-loaded-stage2',
    ],
    'hook' => [
        'provider' => [
            FontManager::class,
            ConfigLoader::class,
        ],
    ],
];
```

`FontManager` resolves the appropriate hooks and renders the `@font-face` CSS, preload ``s and the small stage-swapping script; `ConfigLoader` turns the `fonts` config into `Font` objects and registers them. The `stage_1_class` / `stage_2_class` are applied to the document as each stage loads.

Development
-----------

[](#development)

```
composer install
composer check   # check-deps, cs-check, phpstan
```

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance95

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

33d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1c3a6b11aea9668c9e9ca0c0f8515ef114d344acb552c695d715d35d5b388ea4?d=identicon)[woda](/maintainers/woda)

---

Top Contributors

[![davidmondok](https://avatars.githubusercontent.com/u/3883758?v=4)](https://github.com/davidmondok "davidmondok (6 commits)")[![wolfgangschaefer](https://avatars.githubusercontent.com/u/26325205?v=4)](https://github.com/wolfgangschaefer "wolfgangschaefer (6 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/kaiseki-wp-two-stage-font-loader/health.svg)

```
[![Health](https://phpackages.com/badges/kaiseki-wp-two-stage-font-loader/health.svg)](https://phpackages.com/packages/kaiseki-wp-two-stage-font-loader)
```

###  Alternatives

[symfony/dependency-injection

Allows you to standardize and centralize the way objects are constructed in your application

4.2k455.6M9.6k](/packages/symfony-dependency-injection)[illuminate/contracts

The Illuminate Contracts package.

706130.3M13.3k](/packages/illuminate-contracts)[illuminate/container

The Illuminate Container package.

31182.0M2.4k](/packages/illuminate-container)[ecotone/ecotone

Enterprise architecture layer for Laravel and Symfony — CQRS, Event Sourcing, Durable Workflows (Sagas, Orchestrators), Projections, and Outbox messaging via PHP attributes.

564576.7k53](/packages/ecotone-ecotone)[symfony/type-info

Extracts PHP types information.

20069.8M270](/packages/symfony-type-info)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k43](/packages/civicrm-civicrm-core)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
