Download the PHP package makraz/ux-editorjs without Composer

On this page you can find all versions of the php package makraz/ux-editorjs. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package ux-editorjs

Editor.js Bundle for Symfony using Symfony UX

Symfony UX Bundle implementing Editor.js — a block-style editor that outputs clean JSON data.

Also working out of the box with EasyAdmin.

If you need an easy-to-use block editor (with no complex configuration) in a Symfony project, this is what you need.

Installation

Step 1: Require the bundle

If you are using the AssetMapper component, you're done!

Step 2: JavaScript dependencies (Webpack Encore only)

If you are using Webpack Encore (skip this step if using AssetMapper):

Or with npm:

That's it. You can now use EditorjsType in your Symfony forms.

Basic Usage

In a form, use EditorjsType. It works like a classic form type with additional options:

By default, the editor comes with Header, List, and Paragraph tools enabled.

You can add as many Editor.js fields on a single page as you need, just like any normal form field.

Available Tools

Built-in tools (no extra package required)

These tools are bundled with @editorjs/* packages and can be enabled via the EditorjsTool enum or their DTO class:

Enum DTO Class Description
EditorjsTool::HEADER HeaderTool Heading blocks (H1–H6)
EditorjsTool::LIST ListTool Ordered and unordered lists
EditorjsTool::PARAGRAPH ParagraphTool Paragraph blocks
EditorjsTool::IMAGE ImageTool Image upload and embed
EditorjsTool::CODE CodeTool Code blocks
EditorjsTool::QUOTE QuoteTool Blockquotes
EditorjsTool::WARNING WarningTool Warning/alert blocks
EditorjsTool::TABLE TableTool Tables with optional headings
EditorjsTool::DELIMITER DelimiterTool Horizontal delimiter
EditorjsTool::EMBED EmbedTool Embeds (YouTube, Vimeo, CodePen, GitHub)
EditorjsTool::MARKER MarkerTool Text highlighting (inline)
EditorjsTool::INLINE_CODE InlineCodeTool Inline code (inline)
EditorjsTool::CHECKLIST ChecklistTool Checklists
EditorjsTool::LINK LinkTool Link previews
EditorjsTool::RAW RawTool Raw HTML blocks
EditorjsTool::UNDERLINE UnderlineTool Underline text (inline)

Quick usage — pass enum values directly for default configuration:

Community Tools (built-in DTOs)

The bundle ships with ready-to-use DTOs for popular community tools. These require adding the corresponding npm package to your project (see Adding Community Tools), but no JavaScript code is needed — the bundle handles the dynamic import.

DTO Class Name Package Description
AlignmentParagraphTool paragraph editorjs-paragraph-with-alignment Paragraph with text alignment
AlignmentHeaderTool header editorjs-header-with-alignment Header with text alignment
NestedListTool list @editorjs/nested-list Lists with nesting support
AlertTool alert editorjs-alert Alert/notification blocks
AttachesTool attaches @editorjs/attaches File attachment uploads
SimpleImageTool simpleImage @editorjs/simple-image Simple image (paste URL, no upload)
ToggleBlockTool toggle editorjs-toggle-block Collapsible toggle blocks
TextColorTool textColor editorjs-text-color-plugin Text color / background marker
HyperlinkTool hyperlink editorjs-hyperlink Advanced hyperlink with target/rel
StrikethroughTool strikethrough @sotaproject/strikethrough Strikethrough text (inline)
ColumnsTool columns @calumk/editorjs-columns Multi-column layouts with nested editors

Usage examples

Community Tool Configuration Reference

AlignmentParagraphTool

AlignmentHeaderTool

AlertTool

AttachesTool

NestedListTool

ToggleBlockTool

TextColorTool

Note: Use type: 'text' to register as textColor, or type: 'marker' to register as colorMarker. You can use both in the same form.

HyperlinkTool

ColumnsTool

The columns tool automatically receives the EditorJS library and all other resolved tools, so nested editors inside columns can use the same tools as the parent editor. No extra configuration is needed.

SimpleImageTool / StrikethroughTool

No configuration options — just instantiate:

Block Tunes

Block Tunes are special tools that apply globally to all blocks (e.g. text alignment, indentation). The bundle provides dedicated DTOs for common tunes and a TuneInterface marker.

Tunes are passed in the same editorjs_tools array — the bundle automatically registers them as both tools and global tunes in the EditorJS config.

Built-in Tunes

DTO Class Name Package Options
AlignmentBlockTune textAlignment editorjs-alignment-blocktune default: 'left', 'center', 'right'
TextVariantTune textVariant @editorjs/text-variant-tune
IndentTune indentTune editorjs-indent-tune maxIndent, indentSize, direction

Creating a Custom Tune

Implement TuneInterface (which extends ToolInterface):

Advanced Tool Configuration

Built-in Tool Configuration Reference

For finer control over built-in tools, use the DTO classes instead of the enum. You can mix both approaches:

HeaderTool

ListTool

ImageTool

Note: See Image Upload for the built-in upload controller.

TableTool

QuoteTool

WarningTool

EmbedTool

LinkTool

CodeTool

ParagraphTool

RawTool

Tools with no configuration

The following built-in tools have no additional configuration options:

Editor Options

Use the editorjs_options parameter to configure global editor behavior:

Option Type Default Description
placeholder string 'Start writing...' Placeholder text shown in an empty editor
minHeight int\|string 200 Minimum height of the editor — integer for pixels, string for CSS values (e.g. '50%', '20rem')
maxWidth int\|string 650 Maximum width of the editor content area — integer for pixels, string for CSS values (e.g. '80%', '40rem')
border bool\|string false Show a border around the editor. true for a default border (1px solid #e0e0e0), or a CSS border string (e.g. '2px dashed #ccc')
readOnly bool false Set the editor to read-only mode
autofocus bool false Automatically focus the editor on page load
inlineToolbar bool\|array true Enable or configure the inline toolbar

EasyAdmin Integration

The bundle provides a dedicated EditorjsAdminField for seamless EasyAdmin integration:

To customize the tools, use setFormTypeOptions:

The field automatically registers the Twig form theme and works with both AssetMapper and Webpack Encore.

Image Upload

The bundle provides a built-in upload controller for the Editor.js Image Tool. Three storage options are available: local filesystem, Flysystem, or your own custom handler.

Option 1: Local Filesystem (default)

Store uploads in your Symfony public/ directory:

Then import the bundle routes:

And use the ImageTool with the built-in endpoints:

Option 2: Flysystem

Store uploads via League Flysystem (S3, GCS, Azure, SFTP, etc.):

Option 3: Custom Handler

Implement your own upload logic by creating a service that implements UploadHandlerInterface:

Upload Configuration Reference

Option Type Default Description
enabled bool false Enable the built-in upload controller
handler string 'local' 'local', 'flysystem', or 'custom'
local_dir string '%kernel.project_dir%/public/uploads/editorjs' Local upload directory
local_public_path string '/uploads/editorjs' Public URL path prefix
flysystem_storage string null Flysystem storage service ID
flysystem_path string 'uploads/editorjs' Path within the Flysystem filesystem
flysystem_public_url string '' Public URL prefix for Flysystem files
custom_handler string null Service ID of your UploadHandlerInterface
max_file_size int 5242880 Maximum file size in bytes (5 MB)
allowed_mime_types array ['image/jpeg', 'image/png', 'image/gif', 'image/webp', 'image/svg+xml'] Allowed MIME types

Upload Response Format

The built-in controller returns the format expected by the Editor.js Image Tool:

On error:

Without the Built-in Controller

If you prefer to handle uploads entirely yourself, don't enable the upload config. Create your own controller and pass its URL to the ImageTool:

Your endpoint must return the JSON format shown above.

Data Format

Editor.js outputs structured JSON data. The value stored in your entity will be a JSON string:

Rendering in Twig

To display Editor.js content in your templates, you will need to parse the JSON and render each block. A simple approach:

Extending the Editor

Adding Community Tools

You can use any tool from the Editor.js ecosystem using either a built-in DTO or the generic CustomTool DTO. No JavaScript code required — the bundle dynamically imports the npm package for you.

Step 1: Add the npm package to your project.

For AssetMapper, add it to importmap.php:

For Webpack Encore, install via npm/yarn:

Step 2: Use a built-in DTO or the generic CustomTool:

Creating Your Own Tool DTO

For tools you use frequently, create a dedicated DTO by extending AbstractTool:

Then use it like any built-in tool:

Advanced: JavaScript Event

For full control, you can still register tools manually via the editorjs:options event:

JavaScript Events

The Stimulus controller dispatches events you can listen to for custom behavior:

Event Detail Description
editorjs:options EditorConfig Dispatched before initialization. Modify the config object to add tools or change settings.
editorjs:connect EditorJS Dispatched when the editor is fully initialized and ready.
editorjs:change OutputData Dispatched whenever the editor content changes.

Symfony Live Component Compatibility

The editor is wrapped in a data-live-ignore container, so it works correctly with Symfony Live Components without being destroyed on re-render.

Requirements

License

MIT


All versions of ux-editorjs with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1.0
symfony/stimulus-bundle Version ^2.9.1
symfony/twig-bundle Version ^6.4|^7.0|^8.0
symfony/form Version ^6.4|^7.0|^8.0
symfony/routing Version ^6.4|^7.0|^8.0
symfony/string Version ^6.4|^7.0|^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package makraz/ux-editorjs contains the following files

Loading the files please wait ...