codingo-me/dropzoner
最新稳定版本:1.0.0
Composer 安装命令:
composer require codingo-me/dropzoner
包简介
Simpe Laravel package for image uploads using DropzoneJS library
README 文档
README
This is the simplest Laravel package for image uploads using DropzoneJS.
You pull it via composer, set service provider and include it in your views with @include('dropzoner::dropzone'). After this you need to set JS and CSS files in header and footer. Dropzone will take full width of parent container, and will throw events on image upload and image delete actions. Using event listeners you can hook this package with the rest of your application.
Package uses Image Intervention library for saving images. It has its own filename sanitizer and method for creating unique filenames inside upload directory.
Guide
Require package in your Laravel project with:
composer require codingo-me/dropzoner
Now modify app.php config file and add Dropzoner Service Provider.
Codingo\Dropzoner\DropzonerServiceProvider::class
After setting service provider you need to publish Dropzoners configuration file and assets:
php artisan vendor:publish
When you publish these files, you will be able to modify Dropzoner configuration. There you'll find validator array and validator-messages array.
You also need to add upload path into .env file using key DROPZONER_UPLOAD_PATH. This directory should be write-able by web server, and it needs to end with trailing slash.
Namespace
Package uses Codingo\Dropzoner namespace.
Assets
In head section of your page add DropzoneJS stylesheet file.
<link rel="stylesheet" href="<?php echo asset('vendor/dropzoner/dropzone/dropzone.min.css'); ?>"> Above body closing tag add DropzoneJS JavaScript file, jQuery library and DropzoneJS custom configuration file. We are using jQuery file in custom configuration file, for AJAX requests to backend.
<script src="<?php echo asset('vendor/dropzoner/dropzone/dropzone.min.js'); ?>"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> <script src="<?php echo asset('vendor/dropzoner/dropzone/config.js'); ?>"></script> Including DropzoneJS upload widget
You can include DropzoneJS widget in your HTML with:
@include('dropzoner::dropzone')
It will take full-width of parent div. That view consists of upload form and preview template.
Removal
By default each uploaded image will have Remove link. You can disable this feature once when you publish configuration file.
Events
Idea behind this package is to have plug and play functionality, but you may need to hook upload and delete action with your application so we have 2 events.
- ImageWasUploaded
- ImageWasDeleted
ImageWasUploaded has 2 properties: $original_filename and $server_filename ImageWasDeleted has 1 property: $server_filename
Example Listener
This is a simple listener for ImageWasUploaded events.
<?php namespace App\Listeners; use Codingo\Dropzoner\Events\ImageWasUploaded; class ImageUploadListener { /** * Example listener for image uploads * Event carries original_filename * and server_filename * * @param ImageWasUploaded $event */ public function handle(ImageWasUploaded $event) { \Log::info('Inside ImageUploadListener, image was uploaded: ' . $event->server_filename); } }
License
MIT License (MIT). See License File for more information.
codingo-me/dropzoner 适用场景与选型建议
codingo-me/dropzoner 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 15.85k 次下载、GitHub Stars 达 45, 最近一次更新时间为 2026 年 01 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「dropzone」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 codingo-me/dropzoner 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 codingo-me/dropzoner 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 codingo-me/dropzoner 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Drag and drop file upload for ACF-Fields.
Yii2 Dropzone widget
Contao dropzone directly upload images in edit mask for Contao OpenSource CMS
Dropzone Uploader for Nette Framework and DropzoneJs.
Alfabank REST API integration
Yii2 Dropzone widget
统计信息
- 总下载量: 15.85k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 46
- 点击次数: 30
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-04