johannschopplich / kirby-helpers
Environment, SEO, and build utilities for Kirby CMS
Package info
github.com/johannschopplich/kirby-helpers
Type:kirby-plugin
pkg:composer/johannschopplich/kirby-helpers
Requires
- php: >=8.3
- getkirby/composer-installer: ^1
- vlucas/phpdotenv: ^5
Requires (Dev)
- getkirby/cms: ^5
- phpunit/phpunit: ^12
This package is auto-updated.
Last update: 2026-06-14 20:19:35 UTC
README
Kirby Helpers
Environment variables, SEO meta, XML sitemaps, URL redirects, and Vite integration for Kirby – the utilities most projects re-implement, in one plugin.
Environment • SEO Meta • Sitemaps • Redirects • Vite
When to Use
| I want to… | Use |
|---|---|
Read typed values from a .env file |
env('KEY', $fallback) |
| Emit meta description, OpenGraph, Twitter, and JSON-LD | $page->meta()->social() |
Auto-generate an XML sitemap with hreflang |
sitemap.enabled option |
| Redirect dead URLs without touching existing content | redirects option |
| Serve Vite dev or built assets automatically | vite()->js() / vite()->css() |
Features
🔑 Environment Variables
Load .env files and read variables through a global env() helper, with type coercion and fallbacks.
// .env file support with fallbacks $apiKey = env('STRIPE_SECRET_KEY', 'fallback-key');
🏷️ SEO Meta Tags
Generate meta description, OpenGraph, Twitter Card, JSON-LD, and canonical tags from page fields, page models, and global defaults.
// Complete meta tag generation <?= $page->meta()->social() ?> <?= $page->meta()->robots() ?>
🧭 XML Sitemaps
Auto-generate XML sitemaps with multilingual hreflang, template and page exclusion, and per-page control via blueprints.
// Automatically available at /sitemap.xml // Supports hreflang for multilingual sites
🔀 Smart Redirects
Pattern-based redirect rules that only fire when no existing page or route matches the URL, with placeholders and callback targets.
// Pattern-based redirects with placeholders 'old/blog/(:any)' => 'news/$1'
⚡️ Vite Integration
Switch between the Vite dev server (with HMR) and built manifest.json assets automatically, including Panel asset integration.
// Load Vite assets with automatic dev/production switching <?= vite()->js('src/main.js') ?> <?= vite()->css('src/main.js') ?>
Requirements
- Kirby 5
- PHP 8.3+
Installation
Composer (Recommended)
composer require johannschopplich/kirby-helpers
Manual Installation
Download and copy this repository to /site/plugins/kirby-helpers.
License
MIT License © 2020-PRESENT Johann Schopplich
MIT License © 2020-2022 Bastian Allgeier
MIT License © 2020-2022 Nico Hoffmann