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

Highlight Laravel Package

tempest/highlight

Fast, extensible server-side syntax highlighting for PHP. Tempest Highlight parses code with a simple Highlighter API and supports multiple languages for rendering highlighted output in apps, docs, and tooling—install via Composer and start highlighting in minutes.

View on GitHub
Deep Wiki
Context7

Fast, extensible, server-side code highlighting for web and terminal

Frequently asked questions about Highlight
How do I integrate tempest/highlight into a Laravel project for code snippets in Blade templates?
Install via Composer (`composer require tempest/highlight`), then create a helper function in `AppServiceProvider` to wrap the Highlighter class. Use it in Blade like `@highlight($code, 'php')` to render syntax-highlighted code directly in views. The package outputs pure HTML/CSS, so no frontend dependencies are required.
Does tempest/highlight support Laravel’s HTTP language for API documentation or request logging?
Yes, the package now includes HTTP language support (added in PR #212). Highlight raw HTTP requests, responses, or logs in Blade templates (e.g., `@highlight($request->toJson(), 'http')`) or API responses. It’s ideal for OpenAPI specs, Postman collections, or debugging tools.
What Laravel versions are officially supported by tempest/highlight?
The package is tested with Laravel 10+ and requires PHP 8.1+. No framework-specific changes mean it works seamlessly with Laravel’s ecosystem, including Blade, APIs, and service containers. Always check the [README](https://github.com/tempestphp/highlight) for minor version updates.
Can I customize themes or add new languages for tempest/highlight in Laravel?
Absolutely. Use `Highlighter::setTheme('your-theme')` to apply custom CSS themes or extend the package’s language support by adding new lexers. The modular architecture lets you integrate with Laravel’s config system or publish theme assets via package service providers.
How does tempest/highlight handle performance for large code blocks or HTTP payloads?
The package is optimized for speed, with minimal overhead even for large payloads. HTTP language support adds negligible latency, and the parser is designed for server-side rendering. For high-traffic API docs, consider caching highlighted snippets in Laravel’s cache layer or using queue jobs for async processing.
Is tempest/highlight a good alternative to client-side highlighters like Prism.js for Laravel?
Yes, if you want to eliminate JavaScript dependencies. tempest/highlight renders syntax highlighting server-side, reducing bundle size and improving performance. Replace Prism.js plugins with `@highlight()` in Blade or return formatted snippets via API endpoints. It’s ideal for static sites, CMS pipelines, or headless Laravel apps.
How do I highlight HTTP request/response logs in Laravel’s debugbar or exception pages?
Extend Laravel’s debugbar or exception handlers to use `tempest/highlight`. For example, in a custom `AppServiceProvider`, hook into `debugbar` events and pass HTTP payloads to the highlighter. Use `@highlight($request->getContent(), 'http')` in Blade or return formatted logs in API responses.
Are there any edge cases or limitations with HTTP language support in tempest/highlight?
Test HTTP snippets with malformed data (e.g., missing headers, binary payloads) as edge cases may require validation. Binary data like base64-encoded images should be decoded first. Themes may need adjustments for HTTP-specific syntax (e.g., status codes, methods), but the package provides flexibility to customize via CSS.
Can tempest/highlight be used in Laravel’s API responses for formatted code examples?
Yes, return highlighted snippets directly in API responses. For example, create a `/docs/endpoints` route that uses `tempest/highlight` to format HTTP examples or code samples. The output is HTML/CSS, so it works with any frontend or static site generator.
What’s the maintenance status of tempest/highlight, and are there plans for new languages?
The package is actively maintained with regular updates. Future plans may include additional languages like YAML or TOML, but prioritization depends on community demand. Check the [GitHub repo](https://github.com/tempestphp/highlight) for roadmap discussions or open issues.
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.
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
ecotone/kafka
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata