Pure PHP
syntax highlighting

A port of Shiki. Style code blocks with the same VS Code themes and TextMate grammars, entirely in PHP. No Node, no extensions, no hosted API. Output byte-identical to Shiki.

composer require shikiphp/shikiphp

Real TextMate Grammars

A faithful port of vscode-textmate: embedded languages, injections, and nested repositories. The same grammars Shiki and VS Code tokenize with.

VS Code Themes

Scope-selector specificity and parent-scope matching, ported from vscode-textmate. Single theme or dual light/dark via CSS variables.

Byte-Identical Output

The HTML matches Shiki.js character for character, validated token-for-token by an oracle harness of 214 language/theme scenarios.

Pure-PHP Regex Engine

A vendored JavaScript RegExp engine from inline0/phasis, fed by an oniguruma-to-es port — the same Oniguruma to RegExp path modern Shiki uses.

Transformers

Every Shiki hook (preprocess, tokens, root, pre, code, line, span, postprocess) plus the built-in notation, meta, and whitespace transformers.

The Full Bundle

Every tm-grammars language (200+) and tm-themes theme (65) ships in the box. ANSI terminal output, decorations, and colorReplacements included.

CLI

Highlight a file to HTML, or list bundled languages and themes, straight from the command line with bin/shikiphp.

No Node, No Extensions

Runs on PHP 8.2+ with only ext-json and ext-mbstring. No Node runtime, no native Oniguruma binding, no shelling out.

Ready to highlight?

Install the Composer package and render your first themed code block in seconds.

Read the Docs