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

Shortcode Laravel Package

thunderer/shortcode

Framework-agnostic PHP library for parsing and processing shortcodes/BBCodes. Extract shortcodes from text, handle replacements, and apply them via processors and events. Includes serializers for Text/XML/JSON/YAML. Supports PHP 5.3–8.x.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Dynamic Content Rendering: Enables rich, user-generated content (e.g., forums, CMS, or collaborative tools) with customizable shortcodes (e.g., [user-profile], [image width=600]). Reduces reliance on hardcoded templates or complex frontend frameworks.
  • Build vs. Buy: Buy for teams needing a lightweight, PHP-native solution over reinventing shortcode parsing logic. Avoids dependency on WordPress-specific tools unless compatibility is critical.
  • Roadmap Priorities:
    • Phase 1: Integrate into existing Laravel apps (e.g., blog platforms, documentation systems) to replace manual string replacements or regex hacks.
    • Phase 2: Extend with custom shortcodes for internal tools (e.g., [alert type="warning"] for admin dashboards).
    • Phase 3: Leverage events/serializers for data migration (e.g., converting legacy BBCode to JSON for APIs).
  • Use Cases:
    • Markdown/BBCode Alternatives: For apps where users need simple formatting (e.g., comments, wikis).
    • API Response Formatting: Dynamically generate HTML/JSON snippets (e.g., [api-call endpoint="users"]).
    • A/B Testing: Swap shortcode handlers to test different content variants without code changes.
    • Legacy System Modernization: Replace outdated parsing logic in monolithic PHP apps.

When to Consider This Package

  • Adopt If:

    • Your team uses Laravel/PHP and needs a framework-agnostic shortcode engine (no WordPress coupling).
    • You require nested shortcodes, custom syntax, or event-driven processing (e.g., raw content blocks).
    • Performance is not critical for parsing (use RegexParser for speed; RegularParser for correctness).
    • You need serialization (XML/JSON/YAML) for shortcodes or handler aliases to avoid conflicts.
    • Your use case involves user-generated content with dynamic replacements (e.g., templates, macros).
  • Look Elsewhere If:

    • You’re on a tight deadline and need a pre-built UI (consider TinyMCE or CKEditor plugins).
    • Your app is JavaScript-heavy (e.g., React/Vue) and shortcodes are handled client-side (use libraries like react-markdown).
    • You need real-time collaboration (e.g., Google Docs-style editing; consider ProseMirror or Quill).
    • WordPress compatibility is a hard requirement (use WordpressParser but be aware of limitations).
    • Your parsing volume is extremely high (benchmark first; consider a custom solution or Redis caching).

How to Pitch It (Stakeholders)

For Executives: "This package lets us build dynamic content systems faster without locking into WordPress or heavy frontend tools. For example, we could let users format comments or docs with shortcodes like [highlight]code[/highlight]—processed server-side in PHP—while keeping full control over the output. It’s MIT-licensed, actively maintained, and avoids vendor lock-in. Early adopters like [hypothetical team] used it to reduce template maintenance by 40%."

For Engineers: *"Shortcode is a modular PHP library that replaces ad-hoc regex or string replacements with a clean, extensible API. Key benefits:

  • Plug-and-play: Drop-in facade (ShortcodeFacade) or low-level control (Processor, Parser).
  • Customizable: Supports nested shortcodes, events (e.g., raw content blocks), and even alternative syntax (e.g., [[tag]] instead of [tag]).
  • Performance: RegexParser is fast for simple cases; RegularParser handles edge cases (nesting, malformed tags).
  • Laravel-friendly: Works alongside Blade or APIs—no framework bloat. Use case: Replace your [user-avatar] regex with a handler that fetches data from the DB dynamically. Or serialize shortcodes to JSON for a headless CMS."*

For Designers/Content Teams: *"This tool lets you add interactive elements to static content without coding. For example:

  • Embed videos with [video src="..." width="500"].
  • Highlight text with [note type="warning"].
  • Pull live data like [weather city="NY"]. We can design these shortcodes to match our brand, and they’ll work across all our PHP apps—no frontend dependencies."*
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.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky