PHP code example of ymlluo / laravel-ueditor

1. Go to this page and download the library: Download ymlluo/laravel-ueditor library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ymlluo / laravel-ueditor example snippets


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

    '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}' //删除资源
        ]
        ],

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

        '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' => [
            '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
        ],

        '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
        ],

        '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
        ],

        '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
        ],

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