lanyunit/laravel-uploader 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

lanyunit/laravel-uploader

最新稳定版本:v1.1.7

Composer 安装命令:

composer require lanyunit/laravel-uploader

包简介

集成cos、oss、本地上传的包

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Integrate local, Tencent Cloud COS, Alibaba Cloud OSS uploads

Installation

You can install the package via composer:

composer require lanyunit/laravel-uploader

You can publish the config file with:

php artisan vendor:publish --tag="uploader-config"

This is the contents of the published config file:

return [
    'allow' => [
        'audio' => [
            'mime' => ['audio/mpeg'],
            'max_size' => 30
        ],
        'video' => [
            'mime' => ['video/mp4', 'video/quicktime', 'video/mpeg', 'video/avi'],
            'max_size' => 30
        ],
        'files' => [
            'mime' => '*',
            'max_size' => 30
        ],
        'image' => [
            'mime' => ['image/jpeg', 'image/png', 'image/gif'],
            'max_size' => 30
        ],
    ]
];

Configuration

  1. Add a new disk to your config/filesystems.php config:
<?php

return [
   'disks' => [
       //...
       'uploader' => [
            'driver' => 'uploader',
            'type' => 'local',
            'max_size' => 30,
            'expire_time' => 30 * 60,
            'callback_url' => '',
            'dir_prefix' => 'image/',
            'local' => [],
            'aliyun' => [
                'x-oss-forbid-overwrite' => (bool) env('ALIYUN_FORBID_OVERWRITE', true),
                'success_action_status' => (int) env('ALIYUN_SUCCESS_ACTION_STATUS', 200),
                'bucket' => env('ALIYUN_BUCKET', ''),
                'isCName' => (bool) env('ALIYUN_IS_CNAME', false),
                'endpoint' => env('ALIYUN_ENDPOINT', 'oss-cn-hangzhou.aliyuncs.com'),
                'access_key_id' => env('ALIYUN_ACCESS_KEY_ID', ''),
                'access_key_secret' => env('ALIYUN_ACCESS_KEY_SECRET', ''),
            ],
            'tencent' => [
                'signed_url' => env('TENCENT_SIGNED_URL', ''),
                'use_https' => env('TENCENT_USE_HTTPS', true),
                'domain' => env("TENCENT_DOMAIN", null),
                'app_id' => env('TENCENT_APP_ID', ''),
                'bucket' => env('TENCENT_BUCKET', ''),
                'region' => env('TENCENT_REGION', 'ap-beijing'),
                'secret_id' => env('TENCENT_SECRET_ID', ''),
                'secret_key' => env('TENCENT_SECRET_KEY', ''),
            ]
       ],
       //...
    ]
];
  1. Set callback route
<?php

use Illuminate\Support\Facades\Route;
use Lanyunit\FileSystem\Uploader\Controllers\Callback;

Route::post('callback', [Callback::class, 'index']);

Usage

$storage = app('filesystem')->disk('uploader');
// Web Direct Transfer
dd($storage->getAdapter()->getTokenConfig('image'));

Full API documentation.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 62
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-02-09