Server-side syntax highlighting for PHP applications, with semantic scopes,
embedded languages, and no third-party PHP package dependencies at runtime.
- 
- 
- [](https://packagist.org/packages/alto/code-highlight)
- 
- [](https://github.com/sponsors/smnandre)
+
+
+
+
+
+
+

@@ -16,21 +22,6 @@ process, or external service. Its parsers assign semantic scopes, so themes can
distinguish a function definition from a call or a type definition from a
reference.
-## Installation
-
-Install ALTO Code Highlight with Composer:
-
-```bash
-composer require alto/code-highlight
-```
-
-ALTO Code Highlight requires PHP 8.4 or later, Mbstring, and Tokenizer.
-Tokenizer is included with PHP; Mbstring is available in most PHP distributions
-but must be enabled.
-
-See the [installation guide](docs/installation.md) for verification and
-troubleshooting.
-
## Quick Start
```php
@@ -51,6 +42,21 @@ echo $highlighter->highlight($code, 'php');
`
…
`. Emit a theme stylesheet
once per page, then reuse the highlighter for every code block.
+## Installation
+
+Install ALTO Code Highlight with Composer:
+
+```bash
+composer require alto/code-highlight
+```
+
+ALTO Code Highlight requires PHP 8.4 or later, Mbstring, and Tokenizer.
+Tokenizer is included with PHP; Mbstring is available in most PHP distributions
+but must be enabled.
+
+See the [installation guide](docs/installation.md) for verification and
+troubleshooting.
+
## Parse without rendering
Use `CodeParser` when another component needs semantic tokens instead of HTML: