Surfe.be - passive income

How to Install CkEditor in Laravel

How to Install CkEditor

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

ckeditor install in laravel

Step 1 : Installation CkEditor Package

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

composer require unisharp/laravel-ckeditor

Step 2 : Setup config/app.php 

Next, open your config/app.php and place the below line to the providers array.

Unisharp\Ckeditor\ServiceProvider::class,

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

Step 3 : How to Use CkEditor

Now let’s see how to use the CKEditor. we have a textarea which should get replaced by CKEditor .To do so we are adding id ‘summary-ckeditor’ to the textarea.

<textarea class="form-control" id="summary-ckeditor"></textarea>

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

<script src="{{ asset('vendor/unisharp/laravel-ckeditor/ckeditor.js') }}"></script>
<script>
    CKEDITOR.replace( 'summary-ckeditor' );
</script>

That’s it . We hope you understand how to install and use CKEditor in Laravel. For any questions or suggestions please leave a comment below. 

Leave a comments

LET'S SOCIALITE

Recent Tweets