PHPackages                             emileperron/tinymce-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. emileperron/tinymce-bundle

ActiveSymfony-bundle

emileperron/tinymce-bundle
==========================

A Symfony bundle to add TinyMCE in your apps and forms.

v3.3.0(5mo ago)1537.9k↑37.5%3[2 issues](https://github.com/EmilePerron/tinymce-bundle/issues)1JavaScriptPHP ^8.1CI passing

Since May 10Pushed 5mo ago2 watchersCompare

[ Source](https://github.com/EmilePerron/tinymce-bundle)[ Packagist](https://packagist.org/packages/emileperron/tinymce-bundle)[ RSS](/packages/emileperron-tinymce-bundle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (9)Dependencies (14)Versions (17)Used By (1)

TinyMCE for your Symfony apps and forms
=======================================

[](#tinymce-for-your-symfony-apps-and-forms)

This is a fork of [eckinox/tinymce-bundle](https://github.com/eckinox/tinymce-bundle). Both packages were created by myself, but since I left Eckinox the original bundle has been treated more like an internal package rather than a public &amp; open-source package, so I created this fork to keep supporting the community.

Getting started
---------------

[](#getting-started)

### 1. Install this package via Composer

[](#1-install-this-package-via-composer)

```
composer require emileperron/tinymce-bundle
```

### 2. Start using TinyMCE!

[](#2-start-using-tinymce)

#### Using TinyMCE in Symfony forms

[](#using-tinymce-in-symfony-forms)

Adding a TinyMCE editor in your Symfony forms works like any other form types:

```
use EmilePerron\TinymceBundle\Form\Type\TinymceType;

public function buildForm(FormBuilderInterface $builder, array $options): void
{
    $builder->add("comment", TinymceType::class, [
        "attr" => [
            "toolbar" => "bold italic underline | bullist numlist",
        ],
    ])
    // ...
```

#### Using TinyMCE in templates

[](#using-tinymce-in-templates)

To render a TinyMCE editor in Twig without using Symfony forms, you can use the `tinymce()` Twig function that is provided by this bundle.

Simply provide the value as the first argument and you're good to go.

You can also use the second argument to specify attributes to add to the element.

Here is an example:

```
{{ tinymce("This is a note", { name: "notes", skin: "oxide" }) }}
```

#### Using TinyMCE in Javascript

[](#using-tinymce-in-javascript)

To render a TinyMCE editor in Javascript, first ensure that the main TinyMCE script is loaded.

If you already use the `tinymce()` Twig function or the `TinymceType` on the page, the scripts are already loaded. Otherwise, you can include them on the page either by adding the following scripts manually:

```

```

or by using the `tinymce_scripts()` function like so:

```
{{ tinymce_scripts() }}
```

Then, all you have to do is add a TinyMCE editor web element on the page with the desired attributes and value.

Here's is an example:

```
const contentText = document.createTextNode("Your original text goes here");
const editor = document.createElement("tinymce-editor");

editor.append(contentText);
editor.setAttribute("skin", "appstack");

// If you want to use your default configurations, uncomment this
/*
const attrs = {{ tinymce_attributes({ menubar: "format" })|json_encode|raw }};

for (const key in attrs) {
	editor.setAttribute(key, attrs[key]);
}
*/

// Add the editor to the page
document.body.append(editor);
```

You can refer to [Tiny's web component documentation](https://www.tiny.cloud/docs/tinymce/6/webcomponent-ref)for more information.

Configuring TinyMCE
-------------------

[](#configuring-tinymce)

This bundle includes and uses the web component version of TinyMCE.

You can configure TinyMCE by setting HTML attributes on the editor element itself (``).

When using the form type, you can use the `attr` option to set the attributes. For example, you can set the toolbar's actions like so:

```
use EmilePerron\TinymceBundle\Form\Type\TinymceType;

public function buildForm(FormBuilderInterface $builder, array $options): void
{
    $builder->add("comment", TinymceType::class, [
        "attr" => [
            "toolbar" => "bold italic underline | bullist numlist",
        ],
    ])
    // ...
```

For more information on the different configurations that TinyMCE offers, refer to [Tiny's web component documentation](https://www.tiny.cloud/docs/tinymce/6/webcomponent-ref/).

### Default configurations

[](#default-configurations)

You can set the following default options in a configuration file:

```
tinymce:
    # The configurations mirror the TinyMCE attributes.
    # Learn more about each option in Tiny's documentation:
    # https://www.tiny.cloud/docs/tinymce/6/webcomponent-ref/
    skin: "oxide"
    content_css: "default"
    content_style: ""
    config: "tinymceAdditionalConfig"
    plugins: "advlist autolink link image media table lists"
    toolbar: "bold italic underline | bullist numlist"
    toolbar_mode: ""
    menubar: ""
    contextmenu: ""
    quickbars_insert_toolbar: ""
    quickbars_selection_toolbar: ""
    resize: ""
    icons: ""
    icons_url: ""
    setup: ""
    images_upload_url: "https://yoursite.com/upload"
    images_upload_route: ""
    images_upload_route_params: []
    images_upload_handler: ""
    images_upload_base_path: ""
    images_upload_credentials: "true"
    images_reuse_filename: ""
    powerpaste_word_import: ""
    powerpaste_html_import: ""
    powerpaste_allow_local_images: ""
```

### Setting Additional Configuration Options

[](#setting-additional-configuration-options)

This bundle uses the Web Component version of TinyMCE, which only supports a limited subset of TinyMCE's configuration options via attributes (as seen in the default configuration above).

To add more configuration options that aren't available via attributes on the web component, you need to define a global configuration variable in Javascript and point TinyMCE to that variable, as described in the official TinyMCE docs: [Setting Additional Configuration Options](https://www.tiny.cloud/docs/tinymce/6/webcomponent-ref/#setting-additional-configuration-options).

In practice with this bundle, this looks like:

- Adding a script that defines your additional configuration in a global variable, like so: ```

        window.tinymceConfig = {
            browser_spellcheck: true,
            contextmenu: false,
        };

    ```
- Setting the `config` option in `tinymce.yaml` to the name of your variable, like so: ```
    tinymce:
      config: "tinymceConfig"
    ```

If you want to provide different additional configuration for different TinyMCE fields, you can also set the `config` attribute within your FormBuilder field or Twig Template instead of doing so in your `tinymce.yaml` configuration file.

### Using your configuration in Twig templates

[](#using-your-configuration-in-twig-templates)

If you need to use your configurations in a Twig template, you can use the `tinymce_attributes()` function, which accepts an optional array of custom attributes that take priority over the default configuration.

Here is an example:

```
const attrs = {{ tinymce_attributes({ menubar: "format" })|json_encode|raw }};

for (const key in attrs) {
	editor.setAttribute(key, attrs[key]);
}
```

### File uploads (optional)

[](#file-uploads-optional)

File uploads are not handled by default, as the process will vary from project to project.

To set this up, take a look at [Tiny's web component file upload documentation](https://www.tiny.cloud/docs/tinymce/6/webcomponent-ref/#setting-the-images-upload-url).

To help you get started, we have provided an example of what the implementation may look like. You can find this example in [`docs/file-upload-example.md`](./docs/file-upload-example.md).

Commercial TinyMCE License Key
------------------------------

[](#commercial-tinymce-license-key)

By default, this bundle sets you up to use the GPL licensed version of TinyMCE.

If you have a commercial license that you would like to use instead, you must provide the `license_key` to the global TinyMCE configuration extras, like so:

```
window.tinymceAdditionalConfig = {
	license_key: "",
};
```

AssetMapper support
-------------------

[](#assetmapper-support)

Support for Symfony's AssetMapper is built-in to this bundle since v2.1. No additional configuration is required on your end.

When AssetMapper is used, the TinyMCE files are automatically excluded from being compiled as part of Asset Mapper, as the versioning hash that Asset Mapper automatically adds to filenames and URLs is incompatible with the runtime script imports that are core to TinyMCE.

AppStack skin
-------------

[](#appstack-skin)

This bundle comes with an `appstack` skin, which matches the style of the [AppStack Bootstrap template](https://appstack-bs5.bootlab.io/index.html).

This skin is an extension of the tinymce-5, and it has dark mode support built-in.

To use it, simply specify it in your configuration:

```
# config/packages/tinymce.yaml
tinymce:
    skin: appstack
    content_css: appstack
```

Versions
--------

[](#versions)

Bundle versionTinyMCE versionTinyMCE Web Component version**3.3**7.9.12.3.2**3.2**7.7.22.1.0**3.1**7.6.12.1.0**3.0**7.5.12.1.0**2.1**6.8.52.1.0**2.0**6.8.32.1.0For prior versions, refer to [eckinox/tinymce-bundle](https://github.com/eckinox/tinymce-bundle)Contributing
------------

[](#contributing)

Feel free to submit issues and PRs to the [emileperron/tinymce-bundle](https://github.com/EmilePerron/tinymce-bundle) repository on GitHub.

For more information on how to contribute, check out [CONTRIBUTING.md](./CONTRIBUTING.md).

License
-------

[](#license)

This bundle is distributed under the MIT license.

[TinyMCE](https://github.com/tinymce/tinymce) and the [TinyMCE web component](https://github.com/tinymce/tinymce-webcomponent) are developed and distributed by [Tiny®](https://www.tiny.cloud/) under the MIT license.

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance70

Regular maintenance activity

Popularity39

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 91.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~94 days

Recently: every ~77 days

Total

15

Last Release

150d ago

Major Versions

v0.1.5 → v2.0.02024-05-14

v2.1.0 → v3.0.02024-11-20

PHP version history (2 changes)v0.1.0PHP ^8.0

v2.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/a83bb588c8ca70b698a566d37d5592df3474f4825ca79ca40506c895e71db38d?d=identicon)[EmilePerron](/maintainers/EmilePerron)

---

Top Contributors

[![EmilePerron](https://avatars.githubusercontent.com/u/9383532?v=4)](https://github.com/EmilePerron "EmilePerron (74 commits)")[![Emma1987](https://avatars.githubusercontent.com/u/28593632?v=4)](https://github.com/Emma1987 "Emma1987 (4 commits)")[![Lunyyx](https://avatars.githubusercontent.com/u/31795035?v=4)](https://github.com/Lunyyx "Lunyyx (2 commits)")[![mvdriel](https://avatars.githubusercontent.com/u/408052?v=4)](https://github.com/mvdriel "mvdriel (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/emileperron-tinymce-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/emileperron-tinymce-bundle/health.svg)](https://phpackages.com/packages/emileperron-tinymce-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k16.7M310](/packages/easycorp-easyadmin-bundle)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
