spatie/commonmark-highlighter
Server-side syntax highlighting for league/commonmark code blocks using scrivo/highlight.php. Generates HTML compatible with highlight.js themes, reducing JavaScript and avoiding flashes of unstyled code. Supports 185+ languages for fast, clean markdown rendering.
Use when:
league/commonmark or plan to adopt it for markdown parsing.Look elsewhere if:
For Executives: "This package lets us deliver polished, professional documentation with syntax-highlighted code blocks—without bloating our frontend with JavaScript. By using a server-side PHP solution, we reduce dependencies, improve load times, and ensure consistent formatting across all platforms. It’s a low-maintenance way to elevate our developer experience, align with our existing highlight.js themes, and future-proof our content for SEO and accessibility. The MIT license and Spatie’s reputation mean minimal risk, while the integration with Laravel’s ecosystem accelerates development."
For Engineering Teams:
"This is a lightweight, drop-in solution for syntax highlighting in markdown content using league/commonmark. It replaces client-side libraries like highlight.js with a PHP-native alternative, reducing bundle size and complexity. Since it’s compatible with highlight.js themes, we can reuse existing styles without refactoring. The package is well-maintained (last updated in 2021, though stable), integrates seamlessly with Laravel, and supports 185+ languages out of the box. Ideal for docs, APIs, or any markdown-heavy workflow where server-side processing is feasible."
How can I help you explore Laravel packages today?