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

Editorjs Bundle Laravel Package

darylseven/editorjs-bundle

Symfony bundle integrating Editor.js with Symfony Forms and Twig. Adds an EditorjsType form field, configurable editor setups, and a Twig helper to render/init the editor. Includes example config and JS init (Encore/webpack).

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Symfony 8 Alignment: The bundle is explicitly designed for Symfony 8, ensuring compatibility with its form system, Twig 3+, and PHP 8.1+ features. This makes it a strong fit for modern Symfony applications requiring rich-text editing in admin panels, CMS backends, or form-driven workflows.
  • Editor.js Integration: Leverages headless, modular rich-text editing, ideal for Symfony applications needing structured JSON output (e.g., APIs, headless CMS, or database storage). The integration is form-centric, aligning with Symfony’s validation and data-binding mechanisms.
  • Extensibility: Supports Editor.js plugins (e.g., tables, embeds, custom tools) via npm, enabling tailored functionality without heavy frontend coupling. However, this extensibility is Symfony-form constrained, limiting use cases outside form submissions.

Integration Feasibility

  • Symfony 8 Support: High feasibility due to explicit Symfony 8 compatibility. The bundle abstracts Editor.js integration, reducing boilerplate for Symfony 8 projects.
  • Frontend Dependencies:
    • Encore/Webpack Required: The bundle assumes Encore for asset management, which may introduce feasibility challenges if the project uses alternative tooling (e.g., Vite, Laravel Mix, or CDN-based loading). Custom JS setup is undocumented for non-Encore environments.
    • Plugin Management: Plugins must be installed via npm, which may complicate dependency management in projects without a robust frontend pipeline.
  • Twig Customization: Limited flexibility in overriding the bundled Twig widget, requiring manual template overrides for Symfony 8-specific adjustments (e.g., Twig 3+ syntax).
  • Data Handling: JSON output requires manual serialization/deserialization for storage (e.g., Doctrine json type or custom accessors), adding minor complexity.

Technical Risk

  • Bundle Maturity:
    • Low adoption (0 stars, 0 dependents) introduces risk of undiscovered bugs or lack of long-term maintenance. The Symfony 8 focus suggests recent development, but GitHub metrics (issues/PRs) are absent.
    • Symfony 8-Specific Risks: Potential breaking changes due to Symfony 8’s form system or Twig 3+ updates (e.g., twig.form_themes adjustments). Verify compatibility with Symfony 8’s new features (e.g., FormBuilder syntax).
  • Frontend Complexity:
    • Encore Dependency: Hard requirement may conflict with projects using alternative frontend tooling, increasing integration risk.
    • Plugin Performance: Bundling all plugins upfront could bloat asset size; dynamic loading is unsupported.
  • Data Validation:
    • No built-in validation for Editor.js output, requiring manual validation to prevent malformed submissions.
  • PHP/Package Risks:
    • PHP 8.1+ Requirement: Ensure project supports PHP 8.1+ features (e.g., named arguments, union types).
    • MIT License: Permissive but may conflict with organizational open-source policies (unlikely for most teams).

Key Questions

  1. Symfony 8 Compatibility:
    • Has the bundle been tested with Symfony 8’s form system? Are there known issues with:
      • twig.form_themes registration in Symfony 8?
      • Symfony 8’s new form components (e.g., FormBuilder::add() changes)?
    • Does it support Symfony 8’s new features (e.g., FormBuilder enhancements, Twig 3+ changes)?
  2. Frontend Stack:
    • Are you using Encore/Webpack? If not, how will you handle JS loading (CDN/inline)?
    • Do you need dynamic plugin loading (e.g., lazy-loading @editorjs/* plugins)?
  3. Data Storage:
    • How will Editor.js JSON output be serialized/deserialized for Symfony 8’s Doctrine (e.g., json type, custom accessors)?
    • Are there validation rules for rich-text content (e.g., max length, allowed block types)?
  4. Customization:
    • Do you need to override the Twig widget for Symfony 8’s Twig 3+ changes?
    • Will you require custom Editor.js tools (e.g., image uploads, embeds)?
  5. Performance:
    • How many plugins will you use? Will you bundle all or lazy-load them?
    • Is the editor used on high-traffic pages? (Editor.js can be heavy; consider client-side caching.)
  6. Long-Term Support:
    • Is the MIT license acceptable for your project?
    • Do you have a fallback plan if the bundle becomes unmaintained?
  7. Migration Path:
    • If migrating from an older Symfony version, will you need to backport or use a separate branch?
    • Are there deprecation warnings in Symfony 8 that could affect the bundle?

Integration Approach

Stack Fit

Component Fit Notes
Symfony 8 Forms Excellent Explicitly supports Symfony 8’s form system, including validation and data binding.
Twig 3+ Good Requires form theme inclusion; limited customization without overrides.
Encore/Webpack Required Bundle assumes Encore for JS asset management; alternative setups undocumented.
Editor.js Plugins Good (if using npm) Plugins must be installed via npm; no CDN support documented.
Database Manual Handling JSON output requires custom handling (e.g., Doctrine json type).
API/SPA Use Poor Tied to Symfony Forms; not ideal for pure frontend apps or SPAs.
Symfony 7/6 Limited Bundle supports Symfony 7/6 via older releases, but Symfony 8 is primary focus.

Migration Path

  1. Assess Symfony 8 Compatibility:
    • Test the bundle with Symfony 8’s form system, focusing on:
      • FormBuilder changes (e.g., add() syntax).
      • Twig 3+ template adjustments (e.g., twig.form_themes).
    • Verify plugin compatibility with Symfony 8’s asset pipeline (Encore).
  2. Frontend Setup:
    • If using Encore:
      • Install Editor.js and plugins via npm:
        npm install @editorjs/editorjs @editorjs/header @editorjs/paragraph
        
      • Copy examples/editorjs-init.js to assets/js/editor-init.js and configure plugins.
    • If not using Encore:
      • Evaluate CDN-based loading (undocumented; may require custom JS).
      • Consider Vite/Laravel Mix integration (may need manual asset compilation).
  3. Symfony 8 Configuration:
    • Install the bundle:
      composer require tbmatuka/editorjs-bundle
      
    • Register in config/bundles.php:
      Tbmatuka\EditorjsBundle\TbmatukaEditorjsBundle::class => ['all' => true],
      
    • Configure config/packages/editorjs.yaml (copy from examples/editorjs.yaml).
    • Update Twig form themes:
      twig:
          form_themes: ['@TbmatukaEditorjs/Form/editorjs_widget.html.twig']
      
  4. Form Integration:
    • Replace textareas with EditorjsType in Symfony 8 forms:
      $builder->add('content', EditorjsType::class, [
          'config' => ['tools' => ['header', 'paragraph']],
          'mapped' => false, // If not binding directly to an entity property
      ]);
      
    • Handle JSON data in controllers/validators (e.g., deserialize with json_decode).
  5. JavaScript Initialization:
    • Import editor-init.js in your Encore entry file:
      import './editor-init';
      
    • Customize Editor.js tools/plugins as needed.
  6. Data Storage:
    • Store JSON output in Doctrine using json type or custom accessors:
      #[ORM\Column(type: 'json')]
      private array $content;
      
    • Add validation (e.g., Symfony’s Json constraint or custom validators).

Compatibility Considerations

  • Symfony 7/6: Use older bundle releases (e.g., v0.1.6 for Symfony 6), but Symfony 8 is the primary focus.
  • Alternative Frontend Tools: If not using Encore, document custom JS loading (e.g., CDN, inline scripts) as a migration step.
  • Plugin Dependencies: Ensure all required plugins are **compatible with your Editor.js
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.
daikazu/eloquent-salesforce-objects
unseen-codes/chat
romalytar/yammi-jobs-monitoring-laravel
kisame76/filament-db-table-state
nqxcode/laravel-lucene-search
dpfx/laravel-livewire-wizards
workos/workos-php-laravel
sofa/laravel-global-scope
nawasara/auth-primitives
adhocrat-io/arkhe-main
make-dev/orca-harpoon
itsemon245/lamet
baks-dev/dashboard
amoifr/pickle-panther-bundle
make-dev/orca
dmstr/symfony-system-resources-bundle
dmstr/symfony-job-queue-bundle
dmstr/openapi-json-schema-bundle
dmstr/keycloak-security-bundle
dmstr/doctrine-audit-log-bundle