Search by

helios-ag / fm-tinymce-bundle

helios

TinyMCE bundle, adds TinyMCE editor to your Symfony project

Package info

github.com/helios-ag/FMTinyMCEBundle

Type:symfony-bundle

pkg:composer/helios-ag/fm-tinymce-bundle

Statistics

Installs: 1 817

Dependents: 0

Suggesters: 7

Stars: 6

Open Issues: 1

3.0 2026-09-06 06:44 UTC

This package is auto-updated.

Last update: 2026-09-06 06:46:50 UTC


README

MIT-licensed Symfony 7.4/8 bundle for self-hosted TinyMCE 8 Community Edition.

Code Quality Assurance

Tests Coverage License Version
Tests - Linux Codacy Coverage Software License Latest Stable Version
Downloads
Total Downloads

Requirements

  • PHP 8.2 or newer
  • Symfony 7.4 or 8.x
  • TinyMCE 8 Community Edition (tinymce/tinymce:^8.9)

The bundle is MIT. TinyMCE Community Edition remains GPL-2.0-or-later; use it only where that license is compatible with your application. Tiny Cloud, commercial keys, and premium plugins are not supported.

Install

composer require helios-ag/fm-tinymce-bundle

This bundle does not currently provide a Symfony Flex recipe. Register it in config/bundles.php:

<?php

use FM\TinyMCEBundle\FMTinyMCEBundle;

return [
    // ...
    FMTinyMCEBundle::class => ['all' => true],
];

Register the bundle installer in the consuming application's root composer.json; Composer does not execute scripts supplied by dependencies:

{
  "scripts": {
    "post-install-cmd": ["FM\\TinyMCEBundle\\Composer\\TinyMCEAssetInstaller::copy"],
    "post-update-cmd": ["FM\\TinyMCEBundle\\Composer\\TinyMCEAssetInstaller::copy"]
  }
}

Run composer install or composer update after registering it. The installer mirrors TinyMCE from Composer's vendor directory into public/assets/tinymce. Override the destination with root-level extra.tinymce-dir.

Configure

Create config/packages/fm_tinymce.yaml. The smallest valid configuration uses the built-in TinyMCE 8 defaults:

fm_tinymce:
  instances:
    default: {}

The bundle automatically registers @FMTinyMCE/Form/tinymce_widget.html.twig as a Twig form theme. Do not add it to framework.form_themes yourself.

Default values

The options value is a single free-form map. Its default language, plugins, and toolbar entries are used only when the entire options key is omitted. If you provide options, it replaces that default map; include every TinyMCE option the instance needs.

Option Default
assets.base_path assets/tinymce
assets.script_path assets/tinymce/tinymce.min.js
instances.<name>.enabled true
instances.<name>.inline false
instances.<name>.options.language en
instances.<name>.options.plugins advlist autolink lists link image charmap preview anchor searchreplace visualblocks code fullscreen insertdatetime media table
instances.<name>.options.toolbar undo redo | blocks | bold italic | link image
instances.<name>.file_picker.type null

Every configuration must contain an instance named default. Add other named instances when a form needs different TinyMCE options:

fm_tinymce:
  instances:
    default:
      options:
        plugins: [link, image, lists, code]
        toolbar: 'undo redo | bold italic | link image | code'
    elfinder:
      file_picker:
        type: fm_elfinder
        route: elfinder
        route_parameters: { instance: tinymce }
      options: { }

Use in a form

Select an instance with the instance form option:

use FM\TinyMCEBundle\Form\Type\TinyMCEType;

$builder->add('body', TinyMCEType::class, [
    'instance' => 'default',
]);

Set the form option enabled: false to render a plain textarea. Configure inline: true on an instance to use TinyMCE inline mode.

Use with FMElfinderBundle

Configure the matching FMElfinder instance to use its callback editor. The callback name is fixed and must match the runtime API below:

fm_elfinder:
  instances:
    tinymce:
      editor: callback
      callback_function: FMTinyMCE.receiveFiles
      connector:
        roots:
          uploads:
            driver: LocalFileSystem
            path: '%kernel.project_dir%/public/uploads'
            url: /uploads

Use the elfinder instance in the form with 'instance' => 'elfinder'.

Development

composer test
composer lint
npm test

See UPGRADE-2.0.md for breaking changes.