kanel/dropbox
Composer 安装命令:
composer require kanel/dropbox
包简介
A simple dropbox sdk. one feature at a time.
README 文档
README
End points are added one at the time, if you need one, shoot me an email or make a pull request, i'll be glad to add it or check your PR.
How it works
The client is the main DropBox API. It takes the access token as the only parameter
$client = new \Kanel\DropBox\Client('access_token');
1. Upload
This call uploads a file from your disk to dropbox
If the file is <= 150Mb, it will be uploaded using this end point : https://www.dropbox.com/developers/documentation/http/documentation#files-upload
If the file is > 150Mb an upload session is automatically created using the following end points :
https://www.dropbox.com/developers/documentation/http/documentation#files-upload_session-start https://www.dropbox.com/developers/documentation/http/documentation#files-upload_session-append_v2 https://www.dropbox.com/developers/documentation/http/documentation#files-upload_session-finish
1.1 Basic upload
$client = new Client('access_token'); $client->upload('/path/to/your/file', 'path/folder/dropbox');
Note that if the dropBox folder path is not specified, it defaults to / (root of your application folder)
1.2 Upload with parameters
Dropbox offers some upload parameters you might want to use when uploading a file. You can use the UploadParameters class:
$client = new Kanel\DropBox\Client('access_token'); $uploadParameter = new \Kanel\DropBox\Parameters\UploadParameters(); $uploadParameter->setAutoRenameFile(true); $client->upload('/path/to/your/file', 'path/folder/dropbox', $uploadParameter);
The parameters that can be edited from the parameters are all listed here : https://www.dropbox.com/developers/documentation/http/documentation#files-upload You can check the class Kanel\DropBox\Parameters\UploadParameters for more info too
One of the most important parameter here is $chunksSize This parameter allows you to change the size of chunks to upload when the file exceeds 150Mb.
If the file is > 150Mb the file will be split in chunks of $chunksSize and ech chunk uploaded using sessions
$client = new Kanel\DropBox\Client('access_token'); $uploadParameter = new \Kanel\DropBox\Parameters\UploadParameters(); $uploadParameter->setChunksSize(10485760); $client->upload('/path/to/your/file', 'path/folder/dropbox', $uploadParameter);
In this example, if the file is > 150Mb, it will be split in 10Mb chunks and each chunk uploaded separately.
kanel/dropbox 适用场景与选型建议
kanel/dropbox 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 14 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 01 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 kanel/dropbox 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 kanel/dropbox 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 14
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2018-01-28