Skip to content

Adds syntax highlighting support for embedded HTML, CSS, and JavaScript code within PHP heredoc (<<<HTML) and nowdoc (<<<'HTML') blocks. Automatically highlights code based on the heredoc identifier (HTML, CSS, JS, JAVASCRIPT).

License

dconco/phpspa-highlighter-plugin

Repository files navigation

🎨 PhpSPA Highlighter

Version Acode License

Syntax highlighting for PhpSPA components in Acode

What is this?

PhpSPA uses heredoc syntax to write HTML, CSS, and JavaScript inside PHP components. This plugin makes that code actually look good with proper syntax highlighting.

Features

  • 🎯 Highlights <<<HTML, <<<CSS, <<<JS, <<<JAVASCRIPT heredocs
  • 🔄 Supports both heredoc and nowdoc (<<<'HTML')
  • 📐 Variable interpolation: {$name} in heredocs
  • ✨ Indented heredoc syntax (PHP 7.3+)

Installation

  1. Open Acode → SettingsPlugins
  2. Search for "PhpSPA Highlighter"
  3. Tap Install and restart

Usage

Just write your PhpSPA components normally:

<?php

class Button {
   public function __render($name) {
      return <<<HTML
         <button class="btn" onclick="handleClick()">
            Hello {$name}!
         </button>
      HTML;
   }
   
   public function styles($defaultColor) {
      return <<<CSS
         .btn {
            padding: 10px 20px;
            background: {$defaultColor};
            color: white;
         }
      CSS;
   }
   
   public function script() {
      return <<<JS
         function handleClick() {
            alert('Clicked!');
         }
      JS;
   }
}

That's it! The plugin automatically detects and highlights your heredoc blocks.

Supported Identifiers

Heredoc Nowdoc Language
<<<HTML <<<'HTML' HTML
<<<CSS <<<'CSS' CSS
<<<JS <<<'JS' JavaScript
<<<JAVASCRIPT <<<'JAVASCRIPT' JavaScript

License

MIT


Made for the PhpSPA community ❤️

Report BugRequest FeatureView Docs

About

Adds syntax highlighting support for embedded HTML, CSS, and JavaScript code within PHP heredoc (<<<HTML) and nowdoc (<<<'HTML') blocks. Automatically highlights code based on the heredoc identifier (HTML, CSS, JS, JAVASCRIPT).

Topics

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •