thibedev/laravel-dropzone-chunk 问题修复 & 功能扩展

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

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

thibedev/laravel-dropzone-chunk

Composer 安装命令:

composer require thibedev/laravel-dropzone-chunk

包简介

Laravel 9 Service that make it easy to handle chunked upload (dropzone out of the box)

README 文档

README

Just a little Laravel package that help to handle requests from dropzone.js out of the box. It can be adapted for other front end libraries with few configuration options.

This package works with Laravel 9 only.

Installation

1. Install via composer

composer require thibedev/laravel-dropzone-chunk

2. Publish the config (Optional)

php artisan vendor:publish --provider="ThibeDev\DropzoneChunk\Providers\DropzoneChunkServiceProvider"

Usage

After the installation, you can use the Facade provided : ChunkService If you use dropzone and local storage, you can use this library without any configuration. It is as simple as doing

$result = ChunkService::process($request);

Once all the chunks will be uploaded, $result will be an array containing the name and the path of the uploaded file.

You can provide 3 more arguments to ChunkService::process() method :

  • The name of the request input file, default 'file'
  • The path where you want to save the uploaded file, default '/temp'
  • A boolean to keep the original file name, default false
$result = ChunkService::process($request, 'mySpecialInputName', '/public/media/', true);

If you want to use another frontend provider than dropzone, you can publish the config and change the request_template key or you can use the environment variables. The uuid should be a unique id The chunkindex is the actual chunk index And the totalchunkcount is the total chunk Quite easy :)

'request_template' => [
        'uuid' => env('DROPZONE_CHUNK_UUID', 'dzuuid'),
        'chunkindex' => env('DROPZONE_CHUNK_UUID', 'dzchunkindex'),
        'totalchunkcount' => env('DROPZONE_CHUNK_TOTAL_CHUNKCOUNT', 'dztotalchunkcount'),
    ],

About the storage disk, I haven't tried it with s3 or ftp but it should work, let me know if it works for you !

By default, it will use the local storage, create a temp directory, save all the chunks with a .part extension and finally merge them all in the temp directory with the uuid as name and the original file extension. You can change the temp directory name, the chunk extension and the export disk using the config file or the env vars.

There is two exemples in the exemples directory of this repo.

I know this is not the best library and it might be improved a lot but it does the job and I didn't find any other one that works with Laravel 9...

thibedev/laravel-dropzone-chunk 适用场景与选型建议

thibedev/laravel-dropzone-chunk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 21 次下载、GitHub Stars 达 3, 最近一次更新时间为 2022 年 03 月 03 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「upload」 「laravel」 「chunk」 「dropzone」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 thibedev/laravel-dropzone-chunk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 thibedev/laravel-dropzone-chunk 我们能提供哪些服务?
定制开发 / 二次开发

基于 thibedev/laravel-dropzone-chunk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-03-03