jdz/frontui
Composer 安装命令:
composer require jdz/frontui
包简介
Framework-agnostic front UI helpers (asset versioning, lazy/zoom image tags) for simple Slim/Twig sites
README 文档
README
Framework-agnostic front UI helpers for simple Slim/Twig sites.
The front-end counterpart to jdz/adminUi:
small, dependency-light Twig helpers shared by sites that ship the
jizy-front.js / jizy-front.css bundle without the Callisto framework
runtime — jupiter's own properties and the saturn sites migrated to a plain
Slim front.
Contents
| Namespace | Class | Role |
|---|---|---|
JDZ\FrontUi\Twig |
FrontUiExtension |
Registers the asset() and jizyImg() Twig functions |
JDZ\FrontUi\Html |
Image |
Builds a native-lazy, picviewer-ready <img> tag |
JDZ\FrontUi\Html |
Helper |
Sanitises / normalises WYSIWYG content for front display (clean(), cleanDom()); cleanBlocks() / cleanLinks() hooks let a framework subclass inject its own transforms |
JDZ\FrontUi\Html |
Attributes |
Parse / merge HTML tag attribute strings |
Scope
Rendering helpers only. This is the framework-free replacement for the
framework's JizyTwigExtension, which is coupled to the Callisto kernel
(Config, Symfony Asset\Package, the GD/Imagine thumbnail pipeline).
asset(file, versionable = true)— root-absolute URL with an optional cache-busting?v=…query.jizyImg(src, alt, zoom = false)—<img loading="lazy">with width/height read from the source file;zoomadds thedata-zoomattribute the bundledModalizer.picviewerreads to open a gallery layer.
Thumbnail generation is intentionally out of scope — a simple front site serves the original asset with native lazy-loading.
Usage
use JDZ\FrontUi\Twig\FrontUiExtension; use Slim\Views\Twig; $twig = Twig::create(__DIR__ . '/templates'); $twig->addExtension(new FrontUiExtension( __DIR__ . '/public', // web root, for image dimensions '160', // asset cache-busting version ));
<link rel="stylesheet" href="{{ asset('assets/css/theme.min.css') }}" /> <figure>{{ jizyImg('media/pages/photo.jpg', 'Légende', true) }}</figure>
use JDZ\FrontUi\Html\Helper; $clean = Helper::clean($redactorContent); // tag whitelist + FR typography $tidy = Helper::cleanDom($clean); // strip inline styles + empty nodes
Requirements
PHP >= 8.2, twig/twig ^3.0.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-06-25