torchlight/torchlight-laravel
Torchlight syntax highlighting for Laravel. Highlight code blocks with VS Code-compatible themes and zero JavaScript. Includes caching, configurable themes and host, and Blade components/directives. Requires a Torchlight API token (free for personal/open source).
Torchlight::highlight()), reducing boilerplate for HTTP calls, caching, and error handling. This fits well with Laravel’s service container and HTTP client patterns.torchlight), enabling seamless integration into existing views. This is ideal for documentation-heavy or code-centric applications (e.g., API portals, tutorials).Block class supports macros, allowing customization for advanced use cases (e.g., adding analytics, A/B testing themes, or post-processing hooks).torchlight:install Artisan command automates configuration.blade_components: false in config if needed.composer require torchlight/torchlight-laravel
php artisan torchlight:install
.env with TORCHLIGHT_TOKEN (free from torchlight.dev).<pre><code>) with:
<x-torchlight>
{{ $code }}
</x-torchlight>
echo Torchlight::highlight($code, ['lang' => 'php']);
config/torchlight.php for:
material-theme-palenight).Block macros or use post-processors for:
| Feature | Compatibility Status | Notes |
|---|---|---|
| Laravel 9–13 | ✅ Fully supported | Tested in CI. |
| PHP 8.1+ | ✅ Supported | PHP 8.0 may work but untested. |
| Livewire 2/3 | ✅ Supported | Livewire 1 dropped in v0.5.13. |
| Livewire 1 | ❌ Dropped (v0.5.13) | Use older package version if needed. |
| Octane | ✅ Supported (v0.5.12 fixes memory leak) | Monitor under high load. |
| Jigsaw | ✅ Supported | Non-destructive block clearing. |
| Custom Blade Namespace | ⚠️ Partial | Disable auto-registration if conflict. |
| Non-Laravel Frameworks | ❌ Not supported | Use client-side alternatives. |
.env, and test basic highlighting.How can I help you explore Laravel packages today?