Search by

alto / twig-code-highlight

simonandre

Highlight source code in Twig templates with a tag or filter.

Package info

github.com/altophp/twig-code-highlight

Homepage

Documentation

pkg:composer/alto/twig-code-highlight

Fund package maintenance!

smnandre

Statistics

Installs: 25

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-08-10 01:35 UTC

This package is auto-updated.

Last update: 2026-09-20 16:50:13 UTC


README

Highlight source code directly from Twig templates with a tag or filter powered by ALTO Code Highlight.

  PHP Version   CI   Packagist   License   GitHub Sponsors

Use the block tag for source written in a template or the filter for source provided by your application:

{% code_highlight 'php' %}
<?php echo 'Hello, Alto!';
{% endcode_highlight %}

{{ source|code_highlight('javascript') }}

Installation

composer require alto/twig-code-highlight

The package requires PHP 8.4 or later, ALTO Code Highlight 1.x, and Twig 3.28 or later.

Documentation

Contributing

Contributions of all kinds are welcome. Visit the project on GitHub to report a bug, suggest a feature, or open a pull request.

Before submitting code, run:

# Runs PHP CS Fixer, PHPStan, and PHPUnit
composer qa

Changes to public behavior should include tests and documentation.

Support

ALTO Twig Code Highlight is open source and independently maintained by Simon André. If it is useful to your work, you can support its continued development through GitHub Sponsors.

Sharing the package or starring it on GitHub also helps.

License

ALTO Twig Code Highlight is released by ALTO PHP under the MIT License.