PHPackages                             dh2y/think-ueditor - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. dh2y/think-ueditor

ActiveLibrary

dh2y/think-ueditor
==================

ueditor for thinkphp5

2.3.4(6y ago)35611MITJavaScriptPHP &gt;=5.4.0

Since May 6Pushed 6y ago1 watchersCompare

[ Source](https://github.com/cinaofdai/think-ueditor)[ Packagist](https://packagist.org/packages/dh2y/think-ueditor)[ Docs](https://github.com/cinaofdai/think-ueditor)[ RSS](/packages/dh2y-think-ueditor/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (17)Used By (0)

think-ueditor
=============

[](#think-ueditor)

The ThinkPHP5 ueditor/umeditor 百度编辑器 composer模块

安装
--

[](#安装)

### 一、执行命令安装

[](#一执行命令安装)

```
composer require dh2y/think-ueditor

```

或者

### 二、require安装

[](#二require安装)

##### thinkphp5.0安装

[](#thinkphp50安装)

```
"require": {
        "dh2y/think-ueditor":"1.*"
},

```

##### thinkphp5.1安装

[](#thinkphp51安装)

```
"require": {
        "dh2y/think-ueditor":"2.*"
},

```

或者

### 三、autoload psr-4标准安装

[](#三autoload-psr-4标准安装)

```
   a) 进入vendor/dh2y目录 (没有dh2y目录 mkdir dh2y)
   b) git clone
   c) 修改 git clone下来的项目名称为think-ueditor
   d) 添加下面配置
   "autoload": {
        "psr-4": {
            "dh2y\\sms\\": "vendor/dh2y/think-ueditor/src"
        }
    },
    e) php composer.phar update

```

完全版使用
-----

[](#完全版使用)

#### 添加配置文件

[](#添加配置文件)

1、默认配置在 conf下面的config.json 2、需要自己的配置将 conf下面的ueditor.php复制到 extra目录下面（或者通过下面console添加配置文件）

#### 使用方法

[](#使用方法)

#### 初始化项目资源

[](#初始化项目资源)

> 在项目目录下面找到 command.php 添加控制台添加下面配置

```
    return [
        'dh2y\ueditor\Baidu'
    ];

```

> 执行console命令初始化assets资源

```
    php think baidu   ##默认资源目录
    php think baidu --path /src/path   ##绝对路径
    php think baidu --path admin/js   ##默认资源目录下面的路径

```

> 执行console命令初始化config配置

```
    php think baidu --config y   ##初始化config配置

```

#### 前端调用

[](#前端调用)

> 引用百度编辑器js

```

```

> 普通使用案例

```
 //###############html代码###############

  //###############JS代码###############

  _Ueditor = UE.getEditor('container');

```

> VueJS使用案例

```
    //###############html代码###############

   //###############JS代码###############
    var _editor;           //初始化百度编辑器图片

    var model = {
        model: {}
    };
    var store_model = new Vue({
        el: "#form-admin",
        data: model,
        mounted: function () {
            this.initTime();
            this.initImage();
        },
        methods: {

             //初始化百度编辑器
            initUEditor:function () {
                _Ueditor = UE.getEditor('container');
            },

            //初始化时间选择插件
            initTime:function (event) {
                laydate.render({elem: '#start_time'});
                laydate.render({elem: '#end_time'});
            },

            //初始化百度编辑器上传图片
            initImage:function(event){
                _editor = UE.getEditor('image');
                _editor.ready(function () {
                    //设置编辑器不可用
                    //_editor.setDisabled();
                    //隐藏编辑器，因为不会用到这个编辑器实例，所以要隐藏
                    _editor.hide();
                    //侦听图片上传
                    _editor.addListener('beforeInsertImage', function (t, arg) {
                        console.log( arg);
                        //app_model.model.pic = arg[0].src;
                        //图片预览
                        //$("#form-input-pic").attr("src", arg[0].src);
                    })

                });

            },

            //上传图片点击事件弹出图片框
            upImage:function () {
                var myImage = _editor.getDialog("insertimage");
                myImage.open();
            },

            doSubmit: function () {
                $.ajax({
                    type: 'post',
                    data: this.model,
                    url: "xxxx/xxxx",
                    cache: false,
                    dataType: 'json',
                    success: function (data) {

                    }
                });
            }
        }
    });

```

精简版版使用
------

[](#精简版版使用)

#### 添加配置文件

[](#添加配置文件-1)

1、需要自己的配置将 conf下面的umeditor.php复制到 extra目录下面（或者通过下面console添加配置文件）

#### 使用方法

[](#使用方法-1)

#### 前端调用

[](#前端调用-1)

> 引用百度编辑器js

```
  样式皮肤

```

> 普通使用案例

```
 //###############html代码###############

  //###############JS代码###############

  _UMeditor = UM.getEditor('container', {
      /* 传入配置参数,可配参数列表看umeditor.config.js */
      toolbar: ['undo redo | bold italic underline | link unlink | image video ']
  });

```

> VueJS使用案例

```
    //###############html代码###############

   //###############JS代码###############
    var _UMeditor;           //初始化百度编辑器图片

    var model = {
        model: {}
    };
    var store_model = new Vue({
        el: "#form-admin",
        data: model,
        mounted: function () {
            this.initImage();
        },
        methods: {

             //初始化百度编辑器
            initUEditor:function () {
                _UMeditor = UM.getEditor('container');;
            },

            //初始化百度编辑器上传图片
            initImage:function(event){
                _meditor = UM.getEditor('image');
                _meditor.ready(function () {
                    //设置编辑器不可用
                    //_meditor.setDisabled();
                    //隐藏编辑器，因为不会用到这个编辑器实例，所以要隐藏
                    _meditor.hide();
                    //侦听图片上传
                    _meditor.addListener('beforeInsertImage', function (t, arg) {
                        console.log( arg);
                        //app_model.model.pic = arg[0].src;
                        //图片预览
                        //$("#form-input-pic").attr("src", arg[0].src);
                    })

                });

            },

            //上传图片点击事件弹出图片框
            upImage:function () {
                var myImage = _meditor.getDialog("insertimage");
                myImage.open();
            },

            doSubmit: function () {
                $.ajax({
                    type: 'post',
                    data: this.model,
                    url: "xxxx/xxxx",
                    cache: false,
                    dataType: 'json',
                    success: function (data) {

                    }
                });
            }
        }
    });

```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~30 days

Recently: every ~35 days

Total

16

Last Release

2477d ago

Major Versions

1.4 → 2.12019-03-02

1.5 → 2.3.12019-03-13

1.6 → 2.3.22019-08-01

1.8 → 2.3.42019-08-01

### Community

Maintainers

![](https://www.gravatar.com/avatar/bc26237555d75149f5e33dbfa820b3467ec5c700035c4fa74d6fe5c52e9bd21d?d=identicon)[cinaofdai](/maintainers/cinaofdai)

---

Top Contributors

[![cinaofdai](https://avatars.githubusercontent.com/u/20353921?v=4)](https://github.com/cinaofdai "cinaofdai (22 commits)")

### Embed Badge

![Health badge](/badges/dh2y-think-ueditor/health.svg)

```
[![Health](https://phpackages.com/badges/dh2y-think-ueditor/health.svg)](https://phpackages.com/packages/dh2y-think-ueditor)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
