Weave Code
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 add Torchlight syntax highlighting to my Laravel app without JavaScript?
Install the package via `composer require torchlight/torchlight-laravel`, run `php artisan torchlight:install` to publish the config, and use Blade directives like `@torchlight('php', 'code_here')` or the `Torchlight` facade. The package handles server-side rendering automatically.
Which Laravel versions and PHP versions does Torchlight Laravel support?
Torchlight Laravel supports Laravel 9–13 and PHP 8.1+. It’s fully compatible with Livewire (v1–v3), Octane, and Jigsaw. Check the [README](https://github.com/torchlight-api/torchlight-laravel) for updates on newer versions.
Can I use Torchlight for real-time code blocks in Livewire or Octane?
Yes, Torchlight integrates with Livewire (v1–v3) and Octane. The package auto-registers middleware for Livewire, and Octane users should verify the memory leak fix in v0.5.12. For dynamic updates, ensure your caching strategy aligns with real-time needs.
How do I configure caching for Torchlight in Laravel?
Set the `cache` driver in `config/torchlight.php` (e.g., `redis`, `file`, or `database`). Use `env('TORCHLIGHT_CACHE_DRIVER')` to pull from `.env`. Configure TTL (time-to-live) in the cache driver settings for optimal performance, especially for high-traffic sites.
What happens if the Torchlight API is down or rate-limited?
Torchlight Laravel includes fallback responses configurable in `torchlight.php`. You can also pre-render snippets during off-peak hours or store critical code blocks locally. For offline mode, disable the API temporarily and rely on cached responses.
How do I switch between dark/light themes or use custom themes?
Set the `theme` key in `config/torchlight.php` to any VS Code-compatible theme (e.g., `'material-theme-palenight'`). For multi-theme support, use environment variables or dynamic config loading. Explore all themes at [torchlight.dev/themes](https://torchlight.dev/themes).
Can I add line numbers or custom CSS to highlighted code blocks?
Yes, use post-processors via Torchlight’s macro system. For example, extend the `Torchlight` facade to inject line numbers or custom classes. Check the [Torchlight API docs](https://torchlight.dev) for advanced customization options.
Is Torchlight Laravel secure? How should I store the API token?
Store your `TORCHLIGHT_TOKEN` in `.env` (never hardcode it). The package uses Laravel’s environment system for secure access. For production, ensure your token has restricted permissions if using paid plans.
How do I test Torchlight in my Laravel app before deploying?
Test edge cases like empty code blocks, special characters, and large files (API limits apply). Disable the API temporarily to verify fallback responses. Clear caches with `php artisan cache:clear` and test Blade directives, Livewire interactions, and Octane compatibility.
Are there alternatives to Torchlight Laravel for syntax highlighting?
Alternatives include client-side libraries like Prism.js or Highlight.js (requires JS), or self-hosted solutions like Rouge (Ruby) or Pygments (Python). Torchlight stands out for its VS Code compatibility, no-JS requirement, and seamless Laravel integration, but compare API costs and offline capabilities for your use case.
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.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai