arm092/laravel-rich-text-editor
A secure rich text editor for Laravel forms with Blade and Livewire components, Alpine.js and Tailwind support, sanitized HTML storage, responsive images and tables, plus basic or enhanced code view. Config and prebuilt assets included.
A modern, secure rich text editor for Laravel forms, Alpine.js, Tailwind CSS, and Livewire. It stores semantic HTML, ships with its browser assets, provides responsive images and tables, and includes both Basic and Enhanced code view.

This README is the express guide. See the full documentation for every option, integration, and security detail.
composer require arm092/laravel-rich-text-editor
php artisan rich-text-editor:publish
The publish command copies the configuration and prebuilt assets. Use --force after upgrades when you intentionally want to refresh published files.
<x-rich-text-editor
name="content"
:value="old('content', $post->content)"
label="Content"
/>
The submitted content value is HTML. For safe persistence, add the package cast:
use Arm092\RichTextEditor\Casts\RichTextCast;
protected function casts(): array
{
return [
'content' => RichTextCast::class,
];
}
Laravel 10 applications should place the same entry in the model's protected
$casts property.
Render saved content through the defensive renderer:
<x-rich-text-content :content="$post->content" />
<x-rich-text-editor wire:model="form.content" label="Content" />
The component synchronizes through a native textarea and isolates the editor-managed DOM with wire:ignore. Default, .live, .blur, and .change model modifiers pass through unchanged.
Basic code view:
<script src="/vendor/rich-text-editor/rich-text-editor.js" defer></script>
<div data-rich-text-editor></div>
Enhanced code view:
<script src="/vendor/rich-text-editor/rich-text-editor-with-code.js" defer></script>
<div id="editor"></div>
<script>
document.addEventListener('DOMContentLoaded', () => {
window.editor = RichTextEditor.create('#editor')
})
</script>
Both files expose the same API: create, scan, destroy, getHTML, setHTML, focus, setReadOnly, and instance destroy.
| Option | Default | Purpose |
|---|---|---|
default_profile |
standard |
Selects the formatting and sanitizer profile. |
code_view.enabled |
true |
Shows the HTML code-view command. |
code_view.enhanced |
true |
Loads the enhanced or basic browser bundle. |
assets.auto |
true |
Lets the Blade component include published assets once. |
profiles.*.headings |
[2, 3, 4] |
Restricts heading levels. |
profiles.*.font_sizes |
[] |
Enables only named, allowlisted text sizes. |
profiles.*.images.resize |
20–100, step 5 |
Controls safe responsive image resizing. |
profiles.*.tables.enabled |
true in standard |
Enables responsive tables and their toolbar. |
profiles.*.tables.palette |
Eight theme tokens | Restricts cell text and background colors. |
light, dark, and auto modesSee the full roadmap for scope notes and exclusions.
Laravel Rich Text Editor is open-source software released under the MIT License.
How can I help you explore Laravel packages today?