PHPackages                             ymlluo/laravel-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. [File &amp; Storage](/categories/file-storage)
4. /
5. ymlluo/laravel-ueditor

ActiveLibrary[File &amp; Storage](/categories/file-storage)

ymlluo/laravel-ueditor
======================

:baidu ueditor server side for laravel,power by filesystems,support OSS,Qiniu,COS,AWSs3 etc

v1.2.2(3y ago)5172MITPHPPHP ^7.1|^8.0

Since Nov 3Pushed 3y ago1 watchersCompare

[ Source](https://github.com/ymlluo/laravel-ueditor)[ Packagist](https://packagist.org/packages/ymlluo/laravel-ueditor)[ Docs](https://github.com/ymlluo/laravel-ueditor)[ RSS](/packages/ymlluo-laravel-ueditor/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (6)DependenciesVersions (8)Used By (0)

laravel-UEditor
===============

[](#laravel-ueditor)

此 Laravel 5 Package 是 Ueditor 的后端服务。

- 支持 Laravel &gt;= v5.1 版本
- 基于 laravel的storage 实现文件的管理上传等
- 支持 本地、阿里云 OSS、腾讯COS、七牛，AWS S3,京东云 OSS 等（理论支持全部 Flysystem Adapter）
- 后端支持大文件分片上传
- 提供上传文件管理，重复文件上传时直接返回结果
- 提供上传完成后的 Event 支持
- 配置 Visibility 为 private 时 生成带签名的链接
- 支持配置跨域上传

安装
--

[](#安装)

Via Composer

```
$ composer require ymlluo/laravel-ueditor
```

配置
--

[](#配置)

1. 添加下面一行到 config/app.php 中 providers 部分：

> Laravel &gt; 5.5 支持 Package Auto-Discovery 无需手动添加配置

```
 ymlluo\Ueditor\UeditorServiceProvider::class

```

2.如果使用文件管理功能建议在 config/app.php 中的 aliases 部分添加 （API 参考 api\_doc）

```
  "Ueditor" => "ymlluo\Ueditor\Facades\Ueditor"

```

3.发布配置文件

```
php artisan vendor:publish --provider="ymlluo\\Ueditor\\UeditorServiceProvider"

```

4.如果使用资源管理功能，需要运行 `php artisan migrate` 生成数据库中的表， 修改 config/ueditor.php 配置如下：

```
    'resource' => [
        'enable' => true,//设置为 true 标示使用资源表存储记录。首次安装会需要运行 php artisan migrate
        'file_unique'=>true,//根据文件的sha1 判断，如果已经存在直接返回已经存在的文件信息，防止重复上传
        'custom_table' => '', //默认上传的表名为 upload_resources,可以自定义表名,
    ],
```

使用说明
----

[](#使用说明)

> 此 package 只包含服务端内容，前端编辑器内容请自行下载

> **disk 配置中的 visibility 设置为 private 时，生成带签名的文件链接,有效期取决于 expiration 的设置，单位是秒（ 0 表示永久）**

### 默认配置说明

[](#默认配置说明)

```
    'disk' => 'oss',
    'spit_size' => 10 * 1024 * 1024, //超过10M 的文件上传到 OSS、COS、AWS S3、七牛 等时，使用分片上传
    'route' => [
        'url' => '/serv/ueditor/v1/server', //服务端地址，需要修改前端 ueditor.config.js 中的 serverUrl
        'options' => [
//            'middleware' => ['web','auth'] //正式环境建议取消注释，使用 auth middleware
        ],
        'cors' =>"*" // 默认支持所有跨域请求，支持指定origin 例如 ['http://www.baidu.com'],false 为关闭跨域请求
    ],
    'resource' => [
        'enable' => true,//设置为 true 标示使用资源表存储记录。首次安装会需要运行 php artisan migrate
        'file_unique'=>true,//根据文件的sha1 判断，如果已经存在直接返回已经存在的文件信息，防止重复上传
        'custom_table' => '', //默认上传的表名为 upload_resources,可以自定义表名,
        'route' =>[
        'index'=>    '/serv/resource/index', //资源列表
        'edit'=>    '/serv/resource/edit',  // todo 编辑功能
        'store'=>    '/serv/resource/store', //todo 编辑后保存
        'destroy'=>    '/serv/resource/destroy/{id}' //删除资源
        ]
        ],
```

更多配置请修改 `config/ueditor.php`

### 前端配置注意事项

[](#前端配置注意事项)

默认服务器路由地址为：`/serv/ueditor/v1/server` ,你可以修改配置中的 route.url ，改为你自定义的地址，同时需要修改ueditor.config.js 中的

```
serverUrl: "/serv/ueditor/v1/server"
```

laravel 默认开启 csrf\_token 验证，因此前端需要配置 csrf\_token 如下

```

    这里写你的初始化内容

    var ue = UE.getEditor('container');
        ue.ready(function() {
        ue.execCommand('serverparam', '_token', '{{ csrf_token() }}');//此处为支持laravel5 csrf ,根据实际情况修改,目的就是设置 _token 值.
    });

```

或者 把请求路由加入到排除 csrf 列表

```
# app/Http/Middleware/VerifyCsrfToken.php
    protected $except = [
       '/serv/ueditor/v1/server'
    ];
```

### 本地 Local 支持

[](#本地-local-支持)

> 默认使用 config/filesystems 中的 public 配置

1. laravel 5.4+ 可以运行 php artisan storage:link ，此操作会创建 storage 目录到 public 目录的软链接。当然你也可以使用下面的方法手动指定目录。
2. laravel 5.3 以下版本，请先创建软链接：

```
# 请在项目根目录执行以下命令
$ ln -s `pwd`/storage/app/public `pwd`/public/storage

```

### 阿里云 OSS 支持

[](#阿里云-oss-支持)

1. 推荐安装 jacobcyl/ali-oss-storage

```
composer require jacobcyl/ali-oss-storage:^2.1

```

> 注意:此 package 使用isCName 存在 Bug，会导致上传失败，但是也没有找到更好的替代库 ，如需使用自定义域名或者 CDN 域名请配置 'url' =&gt; env('ALI\_OSS\_URL', '')

2. 在config/filesystems 文件中添加 disks 配置

```
        'oss' => [
            'driver' => 'oss',
            'access_id' => env('ALI_ACCESS_KEY_ID', ''),
            'access_key' => env('ALI_ACCESS_KEY_SECRET', ''),
            'bucket' => env('ALI_OSS_BUCKET', ''),
            'endpoint' => env('ALI_OSS_ENDPOINT', 'oss-cn-beijing.aliyuncs.com'),
            'url' => env('ALI_OSS_URL', ''),
            'ssl' => env('ALI_OSS_SSL', false),
            'isCName' => env('ALI_OSS_IS_CNAME', false),
            'debug' => false,
            'visibility' => 'private',
            'expiration' =>0
        ],
```

### 腾讯云 COSv5 支持

[](#腾讯云-cosv5-支持)

1. 推荐安装 freyo/flysystem-qcloud-cos-v5

```
composer require freyo/flysystem-qcloud-cos-v5

```

2. 在config/filesystems 文件中添加 disks 配置

```
        'cosv5' => [
            'driver' => 'cosv5',
            'region' => env('COSV5_REGION', 'ap-guangzhou'),
            'credentials' => [
                'appId' => env('COSV5_APP_ID'),
                'secretId' => env('COSV5_SECRET_ID'),
                'secretKey' => env('COSV5_SECRET_KEY'),
            ],
            'timeout' => env('COSV5_TIMEOUT', 60),
            'connect_timeout' => env('COSV5_CONNECT_TIMEOUT', 60),
            'bucket' => env('COSV5_BUCKET'),
            'cdn' => env('COSV5_CDN'),
            'scheme' => env('COSV5_SCHEME', 'https'),
            'read_from_cdn' => env('COSV5_READ_FROM_CDN', false),
            'cdn_key' => env('COSV5_CDN_KEY'),
            'encrypt' => env('COSV5_ENCRYPT', false),
            'visibility' => 'public',
            'expiration' =>0
        ],
```

### 七牛支持

[](#七牛支持)

1. 推荐安装 overtrue/laravel-filesystem-qiniu

```
composer require overtrue/laravel-filesystem-qiniu

```

2. 在config/filesystems 文件中添加 disks 配置

```
        'qiniu' => [
            'driver'     => 'qiniu',
            'access_key' => env('QINIU_ACCESS_KEY', 'xxxxxxxxxxxxxxxx'),
            'secret_key' => env('QINIU_SECRET_KEY', 'xxxxxxxxxxxxxxxx'),
            'bucket'     => env('QINIU_BUCKET', 'test'),
            'domain'     => env('QINIU_DOMAIN', 'xxx.clouddn.com'), // or host: https://xxxx.clouddn.com
            'visibility' => 'public',
            'expiration' =>0
        ],
```

### AWS S3 支持

[](#aws-s3-支持)

1. 推荐安装 league/flysystem-aws-s3-v3

```
composer require league/flysystem-aws-s3-v3

```

2. 在config/filesystems 文件中添加 disks 配置

> 特别注意! AWS S3 v4 版本的 SDK 设置签名链接 最多支持 一周的时间

```
        's3' => [
            'driver' => 's3',
            'key' => env('AWS_ACCESS_KEY_ID'),
            'secret' => env('AWS_SECRET_ACCESS_KEY'),
            'region' => env('AWS_DEFAULT_REGION'),
            'bucket' => env('AWS_BUCKET'),
            'url' => env('AWS_URL'),
            'visibility' => 'public',
            'expiration' => 7 * 24 * 60 * 60  //The expiration date of a signature version 4 presigned URL must be less than one week
        ],
```

### 京东云 OSS

[](#京东云-oss)

1.京东云 OSS 使用兼容 AWS S3 的 SDK ,推荐安装 league/flysystem-aws-s3-v3

```
 composer require league/flysystem-aws-s3-v3

```

2. 在config/filesystems 文件中添加 disks 配置

> 特别注意! AWS S3 v4 版本的 SDK 设置签名链接 最多支持 一周的时间

```
        'jd' => [
            'driver' => 's3',
            'key' => env('JD_ACCESS_KEY_ID'),
            'secret' => env('JD_SECRET_ACCESS_KEY'),
            'region' => env('JD_DEFAULT_REGION', 's3.cn-north-1'),
            'endpoint' => env('JD_ENDPOINT', 's3.cn-north-1.jdcloud-oss.com'),
            'bucket' => env('JD_BUCKET'),
            'url' => env('JD_URL'),
            'visibility' => 'private',
            'expiration' => 7 * 24 * 60 * 60  //The expiration date of a signature version 4 presigned URL must be less than one week
        ],
```

### 事件

[](#事件)

- 上传完成事件 `ymlluo\Ueditor\Events\FileUploaded`

返回 $event-&gt;fileInfo;

```
{
    "fileInfo": {
        "state": "SUCCESS",
        "path": "\/uploads\/image\/2019\/1103\/S6zNUSSGmY4eHDsL.png",
        "filename": "S6zNUSSGmY4eHDsL.png",
        "url": "http:\/\/xxxx.oss-cn-beijing.aliyuncs.com\/uploads\/image\/2019\/1103\/S6zNUSSGmY4eHDsL.png?OSSAccessKeyId=xxxxx&Expires=1704164395&Signature=lCMSTW4BkzzjMmD4lbl3LI0rtF8%3D",
        "title": "S6zNUSSGmY4eHDsL.png",
        "original": "S6zNUSSGmY4eHDsL.png",
        "type": ".png",
        "extension": ".png",
        "mime_type": "image\/png",
        "size": 13270,
        "sha1": "6c0dc91bb59b1337d97f53fb2608dde9817fbfbe",
        "creator_uid": 0
    },
    "result": null,
    "socket": null
}

```

TODO
----

[](#todo)

- OSS 服务端签名后直传

License
-------

[](#license)

license. Please see the [license file](license.md) for more information.

MIT

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity68

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 ~216 days

Recently: every ~269 days

Total

6

Last Release

1345d ago

PHP version history (2 changes)v1.0PHP ^7.1

v1.2.2PHP ^7.1|^8.0

### Community

Maintainers

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

---

Top Contributors

[![ymlluo](https://avatars.githubusercontent.com/u/4463625?v=4)](https://github.com/ymlluo "ymlluo (32 commits)")

---

Tags

laravelueditorqiniuosscos

### Embed Badge

![Health badge](/badges/ymlluo-laravel-ueditor/health.svg)

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

###  Alternatives

[yangyifan/upload

上传 SDK for Laravel

12122.7k3](/packages/yangyifan-upload)[shopwwi/webman-filesystem

Flysystem V2 adapter for the webman

2816.5k5](/packages/shopwwi-webman-filesystem)[itbdw/laravel-storage-qiniu

A storage library for laravel5 and qiniu sdk

7015.3k](/packages/itbdw-laravel-storage-qiniu)[menthe/aliyun-ueditor

UEditor for laravel5 and Aliyun OSS.Store all images and files in Aliyun OSS. Support i18n. UEditor is a Rich Text Web Editor From Baidu.

172.4k](/packages/menthe-aliyun-ueditor)

PHPackages © 2026

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