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

Shiki Php Laravel Package

spatie/shiki-php

Use Shiki syntax highlighting from PHP. Highlight code snippets with editor-quality themes and 100+ languages, plus Antlers and Blade. Works great with Laravel via spatie/laravel-markdown and CommonMark through a companion extension.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Developer Experience (DX) Enhancements: Enable syntax-highlighted code blocks in documentation, blogs, or internal tools (e.g., IDE-like previews in admin panels). Justifies investment in improving developer-facing features.
  • Content Strategy: Accelerate content creation by reducing manual formatting effort for technical writers, engineers, or support teams. Aligns with roadmap items for self-service documentation or knowledge bases.
  • Build vs. Buy: Avoid reinventing a high-quality syntax highlighter (vs. custom solutions like Prism.js or Highlight.js). Leverages battle-tested Shiki (used in VS Code) with minimal setup.
  • Use Cases:
    • Laravel/Markdown Integration: Replace static code blocks in spatie/laravel-markdown with dynamic, themed highlights (e.g., GitHub-style dark/light themes).
    • Code Review Tools: Add visual diffs (added/deleted lines) to PR comments or internal review systems.
    • Embedded Editors: Enhance WYSIWYG editors (e.g., TinyMCE, CKEditor) with real-time syntax highlighting for code snippets.
    • API Documentation: Auto-generate interactive code samples with language-specific themes (e.g., Python’s "Dracula" theme).

When to Consider This Package

  • Adopt if:
    • Your stack uses PHP/Laravel and requires client-side-rendered syntax highlighting (not server-side only).
    • You need 100+ languages (including Blade/Antlers) with VS Code theme support.
    • Your team prioritizes maintainability over custom solutions (MIT-licensed, actively updated).
    • You’re building developer-facing tools where visual clarity improves usability (e.g., docs, IDE plugins).
  • Look elsewhere if:
    • You need server-side-only processing (e.g., generating static HTML for PDFs). Use Torchlight or Highlight.js instead.
    • Your project lacks Node.js 20+ (dependency blocker).
    • You require real-time collaboration features (e.g., live code editing). Consider CodeMirror or Monaco Editor.
    • Performance is critical for large codebases (>100KB). Test with your specific workloads (package handles large blocks via stdin since v2.3.3).

How to Pitch It (Stakeholders)

For Executives: "This package lets us deliver VS Code-quality syntax highlighting in our developer tools—like GitHub’s dark/light themes—without building a custom solution. It’s a drop-in upgrade for our Laravel-based docs, support portals, or internal IDEs, reducing formatting time by 80% while improving readability. Since it’s MIT-licensed and maintained by Spatie (a trusted open-source vendor), it’s a low-risk way to enhance our DX. For example, we could auto-generate themed code snippets for our API docs or add visual diffs to PR reviews, making onboarding and collaboration faster."

For Engineers: *"Spatie’s shiki-php wraps the same engine as VS Code’s syntax highlighter, giving us:

  • 100+ languages (including Blade/Antlers) out of the box.
  • Theming flexibility: Use GitHub’s light/dark themes or custom VS Code themes.
  • Line annotations: Highlight, add, delete, or focus lines for diffs or tutorials.
  • Laravel integration: Works seamlessly with spatie/laravel-markdown or commonmark-shiki-highlighter.
  • Performance: Handles large files via stdin (fixed in v2.3.3) and is ~10x faster than alternatives like Prism.js in PHP.

Trade-offs:

  • Requires Node.js 20+ (but we can containerize it).
  • Outputs HTML/CSS (not JSON), so it’s client-side rendered.

Use Cases:

  1. Docs: Replace static code blocks in our Laravel admin panel with interactive, themed snippets.
  2. Support: Add syntax-highlighted error logs to tickets with line annotations.
  3. Internal Tools: Embed a code editor in our dev portal with real-time highlighting.

Alternatives:

  • Torchlight: Simpler but fewer languages/themes.
  • Highlight.js: Client-side only, no PHP integration.
  • Custom: 6+ months of dev time vs. 2 days to integrate this.

Ask: Should we prioritize this for the next docs refresh or the support portal rewrite?"*

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