numencode/wn-dropboxadapter-plugin
Composer 安装命令:
composer require numencode/wn-dropboxadapter-plugin
包简介
NumenCode Dropbox Adapter plugin for Winter CMS
README 文档
README
The Dropbox Adapter Plugin provides Dropbox v2 API integration with Winter CMS as a custom filesystem disk driver.
This allows limited usage of Dropbox with Laravel's Storage facade — primarily for custom logic and backup tools such as
NumenCode.SyncOps.
Target Audience
This plugin is designed for developers who want to interact with Dropbox from within Winter CMS using Laravel’s filesystem abstraction, especially for automation, remote syncing, and backup scenarios.
Note: Due to framework limitations, Winter CMS (as of version 1.2) does not support using Dropbox as a filesystem for core
mediaoruploadsdisks. This plugin is not intended for direct media asset management, but rather for use cases like backup transport, cloud storage sync, or custom plugin integration (e.g.NumenCode.SyncOps).
Installation
This plugin is available for installation via Composer.
composer require numencode/wn-dropboxadapter-plugin
Once the plugin is installed, ensure all migrations are executed:
php artisan winter:up
Requirements
- Winter CMS version 1.2.7 or newer
- PHP 8.0 or later
- A Dropbox App (created in the Dropbox App Console)
- For Refresh Token Flow: You'll need your
App keyandApp secret. - For Temporary Token Flow: You'll need a manually generated
Access token.
- For Refresh Token Flow: You'll need your
Configuration and Authentication
This plugin offers two methods for authenticating with the Dropbox API: the Refresh Token Flow (recommended for
production and long-term use) and the Temporary Token Flow (ideal for quick development or testing).
You can switch between these modes in your .env file.
1. Create a Dropbox App
Regardless of the authentication method, you need to create a Dropbox App.
When creating your app:
- Choose "Scoped access" and select the permissions your application needs (e.g.,
files.content.write,files.content.readfor read/write access).
2. Choose your authentication method
You specify the authentication method in your .env file using the DROPBOX_AUTH_MODE variable.
You can choose between refresh_token and temp_token modes.
a. Refresh Token Flow (recommended for production)
This is the secure and persistent way to authenticate. It uses a long-lived refresh token to automatically obtain new, short-lived access tokens as needed, eliminating the need for manual intervention when tokens expire.
Setup Steps
-
Add Dropbox App credentials to
.env:You'll need your Dropbox
App keyandApp secret.DROPBOX_AUTH_MODE=refresh_token DROPBOX_APP_KEY= DROPBOX_APP_SECRET= DROPBOX_REFRESH_TOKEN=
-
Generate your refresh token:
Use the provided console command to go through the OAuth2 authorization process and obtain your refresh token:
php artisan dropboxadapter:setup
Follow the on-screen prompts:
- It will ask for your Dropbox App key.
- It will provide a URL to open in your browser. Authorize your app on Dropbox. After authorization, Dropbox will
provide an "authorization code" (often in the URL parameters if no redirect URI is set, or directly on the
success page). Copy this
code. - Paste the
authorization codeback into the console. - Enter your Dropbox App secret.
- The command will then exchange this code for a refresh token and display it.
-
Update
.envwith refresh token:Copy the generated refresh token and add it to your
.envfile.
b. Temporary Token Flow (for development/testing only)
This method is quick and easy for temporary testing, but the token will expire after 4 hours and requires manual renewal. Do not use this in production.
Setup Steps
-
Generate a temporary access token:
- Go to your Dropbox App Console.
- Navigate to your app's settings.
- Under "OAuth 2", find the "Generated access token" section and click "Generate". Copy this token.
-
Add temporary token to
.env:DROPBOX_AUTH_MODE=temp_token DROPBOX_TEMP_TOKEN=
Important: If using this mode, the
DROPBOX_APP_KEY,DROPBOX_APP_SECRET, andDROPBOX_REFRESH_TOKENvariables are ignored by the plugin.
3. Define the dropbox disk
Once you have configured your chosen authentication method in .env,
define a new filesystem disk in your config/filesystems.php file:
'dropbox' => [ 'driver' => 'dropbox', ],
4. Usage with Storage Facade
You can now interact with Dropbox programmatically using the Storage facade in Laravel:
Storage::disk('dropbox')->put('backups/site.zip', $contents);
This is especially useful for custom automation (e.g., deployment scripts or remote backup workflows).
Limitations
- Not compatible with Winter CMS native
mediaoruploadsdisks. - Not suitable for asset serving or file uploading through the CMS backend UI.
Use Dropbox through this plugin only for custom filesystem operations that are manually invoked or triggered
via automation (e.g., within the NumenCode.SyncOps plugin or similar).
Example Use Case
This plugin was created to support NumenCode.SyncOps,
a Winter CMS plugin for managing deployments, backups, and environment synchronization. Dropbox serves as a
remote storage destination for sync packages or archive backups.
Changelog
All notable changes are documented in the CHANGELOG.
Contributing
Please refer to the CONTRIBUTING guide for details on contributing to this project.
Security
If you identify any security issues, email info@numencode.com rather than using the issue tracker.
Author
The NumenCode.DropboxAdapter plugin is created and maintained by Blaz Orazem.
For inquiries, contact: info@numencode.com
License
This project is open-sourced software licensed under the MIT license.
numencode/wn-dropboxadapter-plugin 适用场景与选型建议
numencode/wn-dropboxadapter-plugin 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 07 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「storage」 「plugin」 「laravel」 「dropbox」 「numencode」 「winter」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 numencode/wn-dropboxadapter-plugin 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 numencode/wn-dropboxadapter-plugin 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 numencode/wn-dropboxadapter-plugin 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
CakePHP 4.x AdminLTE Theme.
A SDK for working with B2 cloud storage.
Small library to access Microsoft Windows Azure Blob Storage with a Service or a StreamWrapper.
The YADM migrations
Plugin for YOURLS. Default tools to use in some laemmi plugins
Alfabank REST API integration
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 17
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-07-09