How to use CKEditor in PHP Installation and Uses

Here we will discuss what is CKEditor and How to use CKEditor in PHP how to install CKEditor and How to use it.

PHP CKEditor

What is CKEditor?

It is a Modern JavaScript rich text editor. It provides the perfect WYSIWYI UI for creating semantic content.

CKEditor5 is written in ES6 with MVC Architecture.

CKEditor provides rich text editor with auto formatting, Paste from word, Embed media and Responsive images.

It is also designed to handle tree structure complex data model. It also allows collaboration for real time complex structures.

CKEditor is modular, extensible and customizable component

A designable content not possible through HTML form field.

That’s why JS create editor which helps user to write designable content in website.

Lest see how to use ckeditor in php

Like Gmail use Closure Library JS editor, WordPress support TinyMCE WYSIWYG editor same as PHP support CKEditor, WYMeditor, FCKeditor.

Using this editor user can write blog easily with picture colorful content, admin can add product description with table design, product specification.

Admin can write their website content easily by this editor like About Us page content, Privacy Policy, Contact Us, Terms & Condition, etc.

How to Install CKEditor in PHP?

CKEditor is one of the best useful content editors. It is open source free editor.

You can download CKEditor 5 from this link.

ckeditor build

First you have to choose your build either Classic, Ballon, Ballon Block, Inline or Document

Based on build it will provide download link.

Below CKEditor download link is available for classic build.

Download CKEditor

CKEditor5 provides diffent ways to use it you can use command line npm install, can download Zip package or can use CDN.

For Demo purpose we use CKEditor CDN

For CKEditor 5 CDN is

How to use CKEditor5 in HTML

follows these three steps to include CKEditor5 in HTML

Step1:Inside your page add element that will replaced by CKEditor.

above div with id editor will replaced by CKEditor5

Step 2: Load the build(from CDN or download and include)

Step3: Call the ClassicEditor.create() method( for classic editor).

Complete CKEditor Demo Example is below

Classic CKEditor

Similar way you can create Inline, Ballon, Ballon Block and Document Editor.

All CKEditor Demo and JavaScript configuration can be find here

CKEditor in PHP

Save CKEditor data in database

Here we want to create CKEditor in PHP file and save data in database.

  1. Create Database table


2. Write CKEditor and PHP dababase code in index.php

Here CKEditor with form is used to send data to php file.

Run above program and click save button.

After submitting data in will show message New record created successfully.

PHP CKEditor Example

Here You can see record successfully saved in database.

Read CKEditor data from Database


Display CKEditor content from database

How to submit CKEditor value by Ajax call

Here Html file contains jquery ajax call to submit CKEditor data to server.

ckeditor example in php as below

Below php file get data from html file and save to database.