jdz/ui

Shared UI display layer (HTML attribute helpers, WYSIWYG content cleaner, lazy/zoom image tags with on-demand thumbnails) extended by jdz/frontui and jdz/adminui

Maintainers

Package info

github.com/joffreydemetz/ui

Homepage

pkg:composer/jdz/ui

Transparency log

Statistics

Installs: 9

Dependents: 2

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.1 2026-08-19 19:24 UTC

This package is auto-updated.

Last update: 2026-08-19 19:42:18 UTC


README

Shared UI display layer for the JDZ packages — the base both jdz/frontui and jdz/adminui extend.

No framework, no Twig, no dependency beyond PHP 8.2.

What's inside

Class Purpose
JDZ\Ui\Html\Image <img> builder with on-demand GD thumbnails (width-constrained, cached under public/thumbs/), lazy loading, portrait/landscape hint, missing-source fallback, opt-in data-zoom
JDZ\Ui\Html\Attributes Parse / merge HTML attribute strings
JDZ\Ui\Html\Helper Abstract WYSIWYG content sanitiser (tag whitelist, French typography, DOM tidy)

Usage

use JDZ\Ui\Html\Image;

$image = new Image(
    publicPath: __DIR__ . '/public',
    thumbsDir: 'thumbs',
    cacheLife: 0,
    fallbackSrc: '/media/share.png',
);

echo $image->render('media/photos/le-parc.jpg', 'Le parc', false, 120);
// <img src="/thumbs/media_photos_le-parc.jpg-120.jpg" alt="Le parc"
//      loading="lazy" data-orientation="landscape" data-src="/media/photos/le-parc.jpg" />

data-src pairs with a lazy loader (jizy-front/lozad swaps the thumb for the original on scroll); data-zoom pairs with a picture viewer; both are inert without JS.

Tests

composer test