krystal-sf/ux-prism

Prism Js Integration for Krystal Symfony Projects

Maintainers

Package info

gitlab.com/krystal-sf/ux-prism

Homepage

Type:symfony-bundle

pkg:composer/krystal-sf/ux-prism

Transparency log

Statistics

Installs: 1 864

Dependents: 3

Suggesters: 0

Stars: 0

1.0.x-dev 2026-08-05 09:30 UTC

This package is auto-updated.

Last update: 2026-08-05 09:30:11 UTC


README

Prism Js integration for Krystal Symfony UX Projects: code highlighting as a Twig Component, with automatic JSON reformatting.

PHP Version Symfony

Installation

composer require krystal-sf/ux-prism

This bundle is a Krystal Plugin (krystal-sf/plugin-manager) — the recommended way to enable it is through the Plugin Manager:

bin/console plugin:discover
bin/console plugin:enable ksf_prism_js

Alternatively, register it as a regular bundle in config/bundles.php:

return [
    // ...
    Ksf\Plugins\PrismJs\KsfPrismJsBundle::class => ['all' => true],
];

Then import the loader once in your assets/app.js:

import "@krystal-sf/ux-prism";

Usage

<twig:PrismJs:Code language="php" :code="mySourceCode" />

Highlighting runs on DOMContentLoaded and re-runs automatically on DOM mutations (Live Components re-renders) via a MutationObserver.

JSON contents are pretty-printed with JSON.stringify before highlight when the received string is raw.

NB: additional languages are fetched on demand by the Prism autoloader from the jsDelivr CDN.

License

MIT — see LICENSE.