How To Use CKEditor In Laravel 9 Application

Hello Artisan,

In this Laravel 9 CKEditor installation tutorial, I will show you how we can set up CKEditor in Laravel 9 application. I will use unisharp/laravel-ckeditor package to add CKEditor in Laravel 9.

So in this unisharplaravel CKEditor for Laravel 9 example, I will show you step-by-step integration of installing CKEditor in Laravel 9. If you don't know how to install CKEditor in Laravel 9 then this example is for you.

In this article, we are going to show you how to install and use CKEditor in Laravel 8. Now we are going to show how to add CKEditor in laravel 9, so first we have to discuss about Laravel package for CKEditor library. If you wish to use CKEditor apart from Laravel, then please check the official website for CKEditor

 

Read Also : How to Add CKEditor with Image Upload using KCFinder in Laravel

 

ckeditor for laravel 9

To install CKEditor in Laravel, open the command prompt in your project root directory and run the below command.

composer require unisharp/laravel-ckeditor

 

The above command will install CKEditor packages in your project’s vendor directory. Next, open your config/app.php and place the below line to the providers array.

config/app

Unisharp\Ckeditor\ServiceProvider::class,

 

After the above steps, run the below command which copies some of the files and folders from ‘vendor\unisharp\laravel-ckeditor’ to ‘public\vendor\unisharp\laravel-ckeditor’.

php artisan vendor:publish --tag=ckeditor

 

How To Use CKEditor

At this stage, we have completed the steps for installing the CKEditor package. Now let’s see how to use the CKEditor. Let’s say we have a textarea which should get replaced by CKEditor. To do so we are adding id ‘summary-ckeditor’ to the textarea.

 

Next, we need to include ckeditor.js file and write a JavaScript code that replaces Textarea with CKEditor.

 

Above JavaScript code replaces textarea with the CKEditor. Hope it will work for you.

 

#laravel #laravel-9x