Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Torchlight Laravel

Torchlight Laravel Laravel Package

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).

View on GitHub
Deep Wiki
Context7

A Laravel client for Torchlight - the syntax highlighting API.

Frequently asked questions about Torchlight Laravel
How do I install Torchlight Laravel and get started?
Run `composer require torchlight/torchlight-laravel` and then `php artisan torchlight:install` to publish the config file. Add your Torchlight API token to `.env` under `TORCHLIGHT_TOKEN` and configure caching, theme, and host in `config/torchlight.php`.
Which Laravel versions does this package support?
Torchlight Laravel supports Laravel 9 through 13 and requires PHP 8.1+. Always check the package’s changelog for version-specific updates, especially if using Livewire or Octane.
Can I use Torchlight Laravel with Livewire?
Yes, it has built-in support for Livewire 2 and 3. Livewire 1 support was dropped in v0.5.13, so ensure compatibility if using older versions. Real-time updates work seamlessly with Livewire’s reactivity.
What happens if the Torchlight API is down or rate-limited?
The package includes configurable fallback responses (e.g., plain HTML or cached content) via `fallback_response` in the config. You can also customize this behavior using post-processing hooks for graceful degradation.
How does caching work, and can I invalidate it for dynamic content?
Caching is configurable via `TORCHLIGHT_CACHE_DRIVER` (supports Redis, file, etc.). For dynamic content like user-uploaded code, manually clear the cache using `Torchlight::clearCache()` or implement a custom cache key strategy.
Are there any premium themes or custom styling options?
Torchlight supports all VS Code-compatible themes (free and premium) via the `theme` config key. Custom styling can be achieved using post-processing hooks or by overriding the Blade component’s output with CSS.
Does Torchlight Laravel work with Jigsaw static sites?
Yes, it’s fully compatible with Jigsaw. The package ensures non-destructive block clearing during view compilation (fixed in v0.3.0), so syntax highlighting works seamlessly in static Laravel sites.
Can I inject analytics or tracking pixels into highlighted code blocks?
Yes, use the `postProcess` macro on the `Block` class to inject custom HTML (e.g., tracking pixels) after rendering. This allows for analytics without breaking the highlighting logic.
What are the API costs for production use beyond the free tier?
Torchlight’s free tier covers personal and open-source projects. For enterprise or high-traffic production use, check their [pricing page](https://torchlight.dev/pricing) for paid plans. The package’s caching mitigates costs by reducing API calls.
Are there alternatives if I need offline or client-side caching?
Torchlight Laravel is server-side only. For offline support, consider client-side libraries like Prism.js or Highlight.js, though they require JavaScript. The package’s caching reduces API latency but doesn’t replace client-side caching.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
adachsoft/php-code-style