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

Filament Ace Editor Field Laravel Package

jeffersongoncalves/filament-ace-editor-field

Filament v5 form field that embeds the Ace code editor. Adds syntax-highlighted editing with configurable language modes, themes, height, and placeholder support for a richer code/text input experience in Laravel admin panels.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Pros:

    • Filament-Native: Built for Filament v5.3+, ensuring alignment with Filament’s form-component architecture (e.g., make(), rules(), extraAttributes()). Reduces friction in adoption.
    • Syntax-Aware: Ace Editor’s integration provides real-time syntax highlighting for 150+ languages (e.g., HTML, JSON, PHP), improving DX for technical users.
    • Configurable: Supports dynamic theming (e.g., monokai, github), editor modes, and UI customization (height, placeholders) via PHP methods.
    • Validation-Ready: Works seamlessly with Filament’s built-in validation (e.g., required(), maxLength()) and Laravel rules (e.g., json, active_url).
    • MIT License: Zero legal barriers; ideal for internal tools or open-source projects.
  • Cons:

    • Filament Lock-In: Requires Filament v5.3+ (or v4.8+ for v1.x), restricting use to Filament-based applications. Not suitable for non-Filament Laravel stacks (e.g., Livewire, Inertia).
    • Ace Editor Limitations:
      • Legacy Tech Stack: Ace Editor is no longer actively maintained (last update: 2026). Risk of compatibility issues with future Filament major versions.
      • Performance: ~100KB JS bundle may impact initial load times in resource-constrained environments (e.g., mobile admin panels).
      • Feature Gaps: Lacks modern editor capabilities (e.g., IntelliSense, Git integration, real-time collaboration).
    • No Built-In Sanitization: User-generated code (e.g., HTML/JS) requires manual sanitization (e.g., via Laravel’s Purifier or custom middleware) to mitigate XSS risks.
    • Limited Theming: Ace Editor’s themes are predefined; deep customization (e.g., brand-specific styling) may require CSS overrides.

Technical Risk

Risk Area Severity Mitigation Strategy
Filament Version Mismatch High Pin to a specific Filament version (e.g., ^5.3) in composer.json to avoid breaking changes. Monitor Filament’s upgrade guide.
Ace Editor Deprecation Medium Evaluate migration path to Monaco Editor (VS Code’s engine) if Ace Editor becomes unsupported. Track Filament’s roadmap for native editor support.
XSS Vulnerabilities High Implement server-side sanitization (e.g., Purifier for HTML, json_decode() for JSON) and restrict editor modes (e.g., mode('html') only).
Performance Impact Low Test in staging with realistic form loads. Consider lazy-loading the editor if critical.
Customization Limits Low Document workarounds for theming/UI tweaks (e.g., overriding Ace’s CSS via Filament’s extraAttributes()).
Laravel 13+ Compatibility Low Confirmed support for Laravel 13.x (via Testbench v11.0). Monitor for future Laravel major versions.

Key Questions for Stakeholders

  1. Product/UX:
    • Will this editor be used by non-technical users (e.g., marketers editing HTML)? If so, add a sanitization layer and consider a simpler mode (e.g., html only).
    • Are there specific languages/themes required? If Ace Editor lacks support, assess alternatives like filament-monaco-editor.
  2. Tech Stack:
    • Is Filament v5.3+ confirmed for all environments? If not, evaluate the v1.x branch (Filament v4.8+).
    • What’s the long-term maintenance plan for Ace Editor? If high risk, budget for a migration to Monaco Editor.
  3. Security:
    • How will user-generated code be sanitized? Plan for server-side validation (e.g., Purifier for HTML, json_decode() for JSON).
    • Should changes to code fields be logged/audited? Leverage Filament’s activity logs for tracking.
  4. Performance:
    • Will this editor be used in high-traffic forms? Test with tools like Lighthouse to measure impact.
  5. Alternatives:
    • Are there non-editor use cases (e.g., rich text)? Consider filament-tiny-mce for WYSIWYG.
    • Need real-time collaboration? Monaco Editor or CodeMirror may be better fits.

Integration Approach

Stack Fit

  • Primary Use Case: Ideal for Filament v5.3+ applications where users need to edit code snippets (e.g., HTML/CSS/JS templates, API configurations, or workflow rules) directly in admin panels.
  • Tech Stack Compatibility:
    • Backend: Laravel 10/11 (PHP 8.2+), Filament v5.3+.
    • Frontend: Ace Editor (v1.30.0) via CDN or bundled assets. No additional frontend framework required.
    • Database: No schema changes needed; works with existing text fields (e.g., text or longText columns).
  • Extensions:
    • Validation: Integrates with Filament’s validationRules() and Laravel’s built-in validators (e.g., json, active_url).
    • Localization: Supports Filament’s localization system for labels/placeholders.
    • Testing: Compatible with Laravel’s testing tools (e.g., actingAs(), fill()).

Migration Path

  1. Prerequisites:
    • Upgrade to Filament v5.3+ (or v4.8+ for v1.x) if not already using it.
    • Ensure PHP 8.2+ and Laravel 10/11 compatibility.
  2. Installation:
    composer require jeffersongoncalves/filament-ace-editor-field:^2.0
    php artisan vendor:publish --tag=filament-ace-editor-field-config
    
  3. Configuration:
    • Publish the config file to customize default settings (e.g., default mode/theme).
    • Example config/filament-ace-editor-field.php:
      return [
          'default_mode' => 'html',
          'default_theme' => 'monokai',
      ];
      
  4. Implementation:
    • Replace textareas in Filament forms with AceEditorInput:
      use JeffersonGoncalves\Filament\AceEditorField\Forms\Components\AceEditorInput;
      
      AceEditorInput::make('email_template')
          ->mode('html')
          ->theme('github')
          ->height(400)
          ->validationRules(['required', 'max:5000'])
          ->placeholder('Enter HTML for your email template'),
      
  5. Validation/Sanitization:
    • Add server-side validation (e.g., in a Form model):
      use Illuminate\Validation\Rules\File;
      
      public static function rules(): array
      {
          return [
              'email_template' => ['required', 'string', 'max:5000', function ($attribute, $value, $fail) {
                  // Custom sanitization logic (e.g., Purifier for HTML)
                  if (str_contains($value, '<script>')) {
                      $fail('Scripts are not allowed.');
                  }
              }],
          ];
      }
      
  6. Testing:
    • Test in a staging environment with realistic data (e.g., large HTML snippets).
    • Verify syntax highlighting, validation, and edge cases (e.g., empty input, invalid JSON).

Compatibility

  • Filament Versions:
    • v2.x: Requires Filament v5.3+.
    • v1.x: Requires Filament v4.8+ (deprecated; use v2.x for new projects).
  • Laravel Versions:
    • Confirmed support for Laravel 10/11. Test with Laravel 12+ if needed.
  • Browser Support:
    • Ace Editor supports modern browsers (Chrome, Firefox, Safari, Edge). Test in target environments.
  • Asset Conflicts:
    • Minimal risk; Ace Editor is bundled with the package. Ensure no existing Filament plugins override Ace’s JS/CSS.

Sequencing

  1. Phase 1: Pilot Module (2–4 weeks):
    • Integrate into a non-critical module (e.g., marketing templates or API documentation).
    • Gather feedback on UX (e.g., editor responsiveness, syntax highlighting).
  2. Phase 2: Core Forms (3–5 weeks
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.
directorytree/privacy-filter-classifier
directorytree/privacy-filter
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi
splash/scopes
splash/toolkit
testo/output-teamcity
testo/bridge-symfony
spatie/flare-daemon-runtime