Download the PHP package yiipress/highlighter without Composer
On this page you can find all versions of the php package yiipress/highlighter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download yiipress/highlighter
More information about yiipress/highlighter
Files in yiipress/highlighter
Package highlighter
Short Description Native PHP extension for fast server-side syntax highlighting with syntect
License BSD-3-Clause
Informations about the package highlighter
YiiPress Highlighter PHP Extension
The package provides a native PHP extension for fast server-side syntax highlighting powered by syntect.
Requirements
- PHP 8.1 - 8.5.
- PIE to install the extension.
- On Linux and macOS:
cargo,phpize,php-config, C compiler, andmake.
Prebuilt Windows DLLs are attached to GitHub releases.
Installation
Install the extension with PIE:
PIE installs the native extension into the target PHP installation. If the extension is not enabled automatically, add it
to your php.ini:
In an application, use Composer to declare that the extension must be available:
Composer does not build or enable native PHP extensions, so composer require yiipress/highlighter is not an
installation substitute for PIE.
General usage
Highlight an HTML fragment containing code blocks in the form
<pre><code class="language-php">...</code></pre>:
Highlight a raw code string by passing the language name explicitly:
Set a different default theme for a highlighter instance:
Pass a theme for a single call:
When no theme is specified, InspiredGitHub is used.
Themes available by default are:
base16-ocean.darkbase16-eighties.darkbase16-mocha.darkbase16-ocean.lightInspiredGitHubSolarized (dark)Solarized (light)
You can also pass a .tmTheme file path as a theme name:
Use class_exists(YiiPress\Highlighter::class) to check whether the extension is loaded in the current PHP process.
Release
To publish a release, push the release tag, for example git tag 1.0.3 && git push origin 1.0.3.
Do not create releases manually from the GitHub UI: immutable releases require the tag-driven workflow so release assets
can be attached by CI.
License
YiiPress Highlighter PHP Extension is free software. It is released under the terms of the BSD License.
Please see LICENSE for more information.