Backend Development 7 min read

Quickly Integrate Baidu UEditor into Laravel 5 with Cloud Storage Support

This guide shows how to install and configure Baidu's UEditor rich‑text editor in a Laravel 5 project, covering Composer installation, service provider registration, configuration for local or Qiniu cloud storage, and Blade view integration for seamless content editing.

Python Programming Learning Circle
Python Programming Learning Circle
Python Programming Learning Circle
Quickly Integrate Baidu UEditor into Laravel 5 with Cloud Storage Support

Introduction

Many developers need a rich‑text editor for article publishing, and integrating one often leads to compatibility issues. This guide recommends Baidu's UEditor for Laravel 5 because it can be added in minutes and supports local or Qiniu cloud storage.

Installation

Add the package to composer:

"riverslei/laravel-ueditor": "*"

Then run:

composer install

or

composer update

Register the service provider in config/app.php :

Riverslei\UEditor\UEditorServiceProvider::class,

Publish the assets:

php artisan vendor:publish

Configuration

The command creates config/ueditor.php . Important settings include:

core.baseurl – the site root URL (required unless using Qiniu).

core.mode – upload mode, local or qiniu .

Qiniu credentials: accessKey , secretKey , bucket , url .

Various upload limits and path formats for images, videos, scrawls, etc.

Usage

Create a controller, e.g. php artisan make:controller PhotoController , and add a route:

Route::get('/', 'PhotoController@index');

In the controller return the view provided by the package:

/**
 * Test method
 * @return \Illuminate\Http\Response
 */
public function index()
{
    return view('vendor.UEditor.test');
}

In the Blade view include the editor assets and initialize UEditor:

@include('UEditor::head')
<form method="post">
    <input type="hidden" name="_token" value="{{ csrf_token() }}">
    <textarea id="container" name="content">Your initial content</textarea>
    <input type="submit" value="Submit">
</form>
<script type="text/javascript">
    var ue = UE.getEditor('container', {
        initialFrameWidth : 1200,
        initialFrameHeight : 350,
    });
    ue.ready(function() {
        ue.execCommand('serverparam', '_token', '{{ csrf_token() }}');
    });
</script>

Adjust /public/laravel-ueditor/ueditor.config.js to hide unwanted toolbar buttons if needed.

Conclusion

Following these steps you can quickly embed a fully functional rich‑text editor in a Laravel project, with optional cloud storage for uploaded media.

IntegrationPHPcloud storageRich Text EditorLaravelUEditor
Python Programming Learning Circle
Written by

Python Programming Learning Circle

A global community of Chinese Python developers offering technical articles, columns, original video tutorials, and problem sets. Topics include web full‑stack development, web scraping, data analysis, natural language processing, image processing, machine learning, automated testing, DevOps automation, and big data.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.