Showing
39 changed files
with
1266 additions
and
0 deletions
vendor/Qiniu/CHANGELOG.md
0 → 100755
| 1 | +# Changelog | ||
| 2 | + | ||
| 3 | +## 7.2.6 (2018-05-18) | ||
| 4 | +* 修复rs,rsf在不同机房默认的https域名 | ||
| 5 | + | ||
| 6 | +## 7.2.5 (2018-05-10) | ||
| 7 | +* 修复表单上传中多余的参数checkCrc导致的fname错位问题 | ||
| 8 | + | ||
| 9 | +## 7.2.4 (2018-05-09) | ||
| 10 | +### 增加 | ||
| 11 | +* 连麦功能 | ||
| 12 | + | ||
| 13 | +## 7.2.3 (2018-01-20) | ||
| 14 | +### 增加 | ||
| 15 | +* 新加坡机房 | ||
| 16 | +### 修正 | ||
| 17 | +* 获取域名的入口域名 | ||
| 18 | +* http回复头部兼容大小写 | ||
| 19 | + | ||
| 20 | +## 7.2.2 (2017-11-06) | ||
| 21 | +### 增加 | ||
| 22 | +* Qiniu算法的鉴权方法 | ||
| 23 | + | ||
| 24 | +## 7.1.4 (2017-06-21) | ||
| 25 | +### 增加 | ||
| 26 | +* cdn 文件/目录 刷新 | ||
| 27 | +* cdn 获取 流量/带宽 | ||
| 28 | +* cdn 获取域名的访问日志列表 | ||
| 29 | +* cdn 对资源链接进行时间戳防盗链签名 | ||
| 30 | + | ||
| 31 | +## 7.1.3 (2016-11-18) | ||
| 32 | +### 增加 | ||
| 33 | +* move, copy操作增加force参数 | ||
| 34 | + | ||
| 35 | +## 7.1.2 (2016-11-12) | ||
| 36 | +### 修正 | ||
| 37 | +* 明确抛出获取各区域域名失败时的报错 | ||
| 38 | + | ||
| 39 | +## 7.1.1 (2016-11-02) | ||
| 40 | +### 修正 | ||
| 41 | +* 多区域配置文件存储目录从home修改到tmp目录 | ||
| 42 | + | ||
| 43 | + | ||
| 44 | +## 7.1.0 (2016-10-22) | ||
| 45 | +### 增加 | ||
| 46 | +* 多存储区域的支持 | ||
| 47 | + | ||
| 48 | +## 7.0.8 (2016-07-19) | ||
| 49 | +### 增加 | ||
| 50 | +* demo | ||
| 51 | +* https url 支持 | ||
| 52 | +* deleteAfterDays 策略 | ||
| 53 | +* 添加图片处理链接统一拼接方法 by @SherlockRen | ||
| 54 | + | ||
| 55 | +## 7.0.7 (2016-01-12) | ||
| 56 | +### 修正 | ||
| 57 | +* PersistentFop参数pipeline和notify_url失效 | ||
| 58 | +* resume 模式 close file inputstream | ||
| 59 | + | ||
| 60 | +## 7.0.6 (2015-12-05) | ||
| 61 | +### 修正 | ||
| 62 | +* php7.0 Json 对空字符串解析单元测试报错 | ||
| 63 | +* 开启安全模式或者设置可操作目录树时,设置CURLOPT_FOLLOWLOCATION报错, by @twocabbages | ||
| 64 | +* fetch 支持不指定key, by @sinkcup | ||
| 65 | + | ||
| 66 | +## 7.0.5 (2015-10-29) | ||
| 67 | +### 增加 | ||
| 68 | +* 增加上传策略最小文件大小限制 fsizeMin | ||
| 69 | +* 增加常见examples | ||
| 70 | + | ||
| 71 | +## 7.0.4 (2015-07-23) | ||
| 72 | +### 修正 | ||
| 73 | +* 一些地方的严格比较检查 | ||
| 74 | +* resumeupload 备用地址失效 | ||
| 75 | + | ||
| 76 | +## 7.0.3 (2015-07-10) | ||
| 77 | +### 修改 | ||
| 78 | +* 多zone 支持 | ||
| 79 | + | ||
| 80 | +## 7.0.2 (2015-04-18) | ||
| 81 | +### 修改 | ||
| 82 | +* fetch 接口返回内容调整 | ||
| 83 | +* pfop 接口调整 | ||
| 84 | + | ||
| 85 | +###修正 | ||
| 86 | +* exception 类调用 | ||
| 87 | + | ||
| 88 | +## 7.0.1 (2015-03-27) | ||
| 89 | +### 增加 | ||
| 90 | +* 增加代码注释 | ||
| 91 | + | ||
| 92 | +## 7.0.0 (2015-02-03) | ||
| 93 | + | ||
| 94 | +### 增加 | ||
| 95 | +* 简化上传接口 | ||
| 96 | +* 自动选择断点续上传还是直传 | ||
| 97 | +* 重构代码,接口和内部结构更清晰 | ||
| 98 | +* 改变mime | ||
| 99 | +* 代码覆盖度报告 | ||
| 100 | +* policy改为array, 便于灵活增加,并加入过期字段检查 | ||
| 101 | +* 文件列表支持目录形式 | ||
| 102 | +* 利用元编程方式支持 fop 和 pfop |
vendor/Qiniu/CONTRIBUTING.md
0 → 100755
| 1 | +# 贡献代码指南 | ||
| 2 | + | ||
| 3 | +我们非常欢迎大家来贡献代码,我们会向贡献者致以最诚挚的敬意。 | ||
| 4 | + | ||
| 5 | +一般可以通过在Github上提交[Pull Request](https://github.com/qiniu/php-sdk)来贡献代码。 | ||
| 6 | + | ||
| 7 | +## Pull Request要求 | ||
| 8 | + | ||
| 9 | +- **[PSR-2 编码风格标准](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** 。要通过项目中的code sniffer检查。 | ||
| 10 | + | ||
| 11 | +- **代码格式** 提交前 请按 ./vendor/bin/phpcbf --standard=PSR2 进行格式化。 | ||
| 12 | + | ||
| 13 | +- **必须添加测试!** - 如果没有测试(单元测试、集成测试都可以),那么提交的补丁是不会通过的。 | ||
| 14 | + | ||
| 15 | +- **记得更新文档** - 保证`README.md`以及其他相关文档及时更新,和代码的变更保持一致性。 | ||
| 16 | + | ||
| 17 | +- **考虑我们的发布周期** - 我们的版本号会服从[SemVer v2.0.0](http://semver.org/),我们绝对不会随意变更对外的API。 | ||
| 18 | + | ||
| 19 | +- **创建feature分支** - 最好不要从你的master分支提交 pull request。 | ||
| 20 | + | ||
| 21 | +- **一个feature提交一个pull请求** - 如果你的代码变更了多个操作,那就提交多个pull请求吧。 | ||
| 22 | + | ||
| 23 | +- **清晰的commit历史** - 保证你的pull请求的每次commit操作都是有意义的。如果你开发中需要执行多次的即时commit操作,那么请把它们放到一起再提交pull请求。 | ||
| 24 | + | ||
| 25 | +## 运行测试 | ||
| 26 | + | ||
| 27 | +``` bash | ||
| 28 | +./vendor/bin/phpunit tests/Qiniu/Tests/ | ||
| 29 | + | ||
| 30 | +``` |
vendor/Qiniu/LICENSE
0 → 100755
| 1 | +The MIT License (MIT) | ||
| 2 | + | ||
| 3 | +Copyright (c) 2014 Qiniu, Ltd.<sdk@qiniu.com> | ||
| 4 | + | ||
| 5 | +Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| 6 | +of this software and associated documentation files (the "Software"), to deal | ||
| 7 | +in the Software without restriction, including without limitation the rights | ||
| 8 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| 9 | +copies of the Software, and to permit persons to whom the Software is | ||
| 10 | +furnished to do so, subject to the following conditions: | ||
| 11 | + | ||
| 12 | +The above copyright notice and this permission notice shall be included in all | ||
| 13 | +copies or substantial portions of the Software. | ||
| 14 | + | ||
| 15 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 16 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 17 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| 18 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 19 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| 20 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| 21 | +SOFTWARE. | ||
| 22 | + |
vendor/Qiniu/README.md
0 → 100755
| 1 | +# Qiniu Cloud SDK for PHP | ||
| 2 | +[](http://doxygen.io/github.com/qiniu/php-sdk/) | ||
| 3 | +[](LICENSE) | ||
| 4 | +[](https://travis-ci.org/qiniu/php-sdk) | ||
| 5 | +[](https://packagist.org/packages/qiniu/php-sdk) | ||
| 6 | +[](https://packagist.org/packages/qiniu/php-sdk) | ||
| 7 | +[](https://scrutinizer-ci.com/g/qiniu/php-sdk/?branch=master) | ||
| 8 | +[](https://scrutinizer-ci.com/g/qiniu/php-sdk/?branch=master) | ||
| 9 | +[](https://gitter.im/qiniu/php-sdk?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | ||
| 10 | +[](http://weibo.com/qiniutek) | ||
| 11 | + | ||
| 12 | +## 安装 | ||
| 13 | + | ||
| 14 | +* 通过composer,这是推荐的方式,可以使用composer.json 声明依赖,或者运行下面的命令。SDK 包已经放到这里 [`qiniu/php-sdk`][install-packagist] 。 | ||
| 15 | +```bash | ||
| 16 | +$ composer require qiniu/php-sdk | ||
| 17 | +``` | ||
| 18 | +* 直接下载安装,SDK 没有依赖其他第三方库,但需要参照 composer的autoloader,增加一个自己的autoloader程序。 | ||
| 19 | + | ||
| 20 | +## 运行环境 | ||
| 21 | + | ||
| 22 | +| Qiniu SDK版本 | PHP 版本 | | ||
| 23 | +|:--------------------:|:---------------------------:| | ||
| 24 | +| 7.x | cURL extension, 5.3 - 5.6,7.0 | | ||
| 25 | +| 6.x | cURL extension, 5.2 - 5.6 | | ||
| 26 | + | ||
| 27 | +## 使用方法 | ||
| 28 | + | ||
| 29 | +### 上传 | ||
| 30 | +```php | ||
| 31 | +use Qiniu\Storage\UploadManager; | ||
| 32 | +use Qiniu\Auth; | ||
| 33 | +... | ||
| 34 | + $upManager = new UploadManager(); | ||
| 35 | + $auth = new Auth($accessKey, $secretKey); | ||
| 36 | + $token = $auth->uploadToken($bucketName); | ||
| 37 | + list($ret, $error) = $upManager->put($token, 'formput', 'hello world'); | ||
| 38 | +... | ||
| 39 | +``` | ||
| 40 | + | ||
| 41 | +## 测试 | ||
| 42 | + | ||
| 43 | +``` bash | ||
| 44 | +$ ./vendor/bin/phpunit tests/Qiniu/Tests/ | ||
| 45 | +``` | ||
| 46 | + | ||
| 47 | +## 常见问题 | ||
| 48 | + | ||
| 49 | +- $error保留了请求响应的信息,失败情况下ret 为none, 将$error可以打印出来,提交给我们。 | ||
| 50 | +- API 的使用 demo 可以参考 [单元测试](https://github.com/qiniu/php-sdk/blob/master/tests)。 | ||
| 51 | + | ||
| 52 | +## 代码贡献 | ||
| 53 | + | ||
| 54 | +详情参考[代码提交指南](https://github.com/qiniu/php-sdk/blob/master/CONTRIBUTING.md)。 | ||
| 55 | + | ||
| 56 | +## 贡献记录 | ||
| 57 | + | ||
| 58 | +- [所有贡献者](https://github.com/qiniu/php-sdk/contributors) | ||
| 59 | + | ||
| 60 | +## 联系我们 | ||
| 61 | + | ||
| 62 | +- 如果需要帮助,请提交工单(在portal右侧点击咨询和建议提交工单,或者直接向 support@qiniu.com 发送邮件) | ||
| 63 | +- 如果有什么问题,可以到问答社区提问,[问答社区](http://qiniu.segmentfault.com/) | ||
| 64 | +- 更详细的文档,见[官方文档站](http://developer.qiniu.com/) | ||
| 65 | +- 如果发现了bug, 欢迎提交 [issue](https://github.com/qiniu/php-sdk/issues) | ||
| 66 | +- 如果有功能需求,欢迎提交 [issue](https://github.com/qiniu/php-sdk/issues) | ||
| 67 | +- 如果要提交代码,欢迎提交 pull request | ||
| 68 | +- 欢迎关注我们的[微信](http://www.qiniu.com/#weixin) [微博](http://weibo.com/qiniutek),及时获取动态信息。 | ||
| 69 | + | ||
| 70 | +## 代码许可 | ||
| 71 | + | ||
| 72 | +The MIT License (MIT).详情见 [License文件](https://github.com/qiniu/php-sdk/blob/master/LICENSE). | ||
| 73 | + | ||
| 74 | +[packagist]: http://packagist.org | ||
| 75 | +[install-packagist]: https://packagist.org/packages/qiniu/php-sdk |
vendor/Qiniu/autoload.php
0 → 100755
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +function classLoader($class) | ||
| 4 | +{ | ||
| 5 | + $path = str_replace('\\', DIRECTORY_SEPARATOR, $class); | ||
| 6 | + $file = __DIR__ . '/src/' . $path . '.php'; | ||
| 7 | + | ||
| 8 | + if (file_exists($file)) { | ||
| 9 | + require_once $file; | ||
| 10 | + } | ||
| 11 | +} | ||
| 12 | +spl_autoload_register('classLoader'); | ||
| 13 | + | ||
| 14 | +require_once __DIR__ . '/src/Qiniu/functions.php'; |
vendor/Qiniu/composer.json
0 → 100755
| 1 | +{ | ||
| 2 | + "name": "qiniu/php-sdk", | ||
| 3 | + "type": "library", | ||
| 4 | + "description": "Qiniu Resource (Cloud) Storage SDK for PHP", | ||
| 5 | + "keywords": ["qiniu", "storage", "sdk", "cloud"], | ||
| 6 | + "homepage": "http://developer.qiniu.com/", | ||
| 7 | + "license": "MIT", | ||
| 8 | + "authors": [ | ||
| 9 | + { | ||
| 10 | + "name": "Qiniu", | ||
| 11 | + "email": "sdk@qiniu.com", | ||
| 12 | + "homepage": "http://www.qiniu.com" | ||
| 13 | + } | ||
| 14 | + ], | ||
| 15 | + "require": { | ||
| 16 | + "php": ">=5.3.3" | ||
| 17 | + }, | ||
| 18 | + "require-dev": { | ||
| 19 | + "phpunit/phpunit": "~4.0", | ||
| 20 | + "squizlabs/php_codesniffer": "~2.3" | ||
| 21 | + }, | ||
| 22 | + "autoload": { | ||
| 23 | + "psr-4": {"Qiniu\\": "src/Qiniu"}, | ||
| 24 | + "files": ["src/Qiniu/functions.php"] | ||
| 25 | + } | ||
| 26 | +} |
vendor/Qiniu/docs/rtc/README.md
0 → 100755
| 1 | +# Rtc Streaming Cloud Server-Side Library For PHP | ||
| 2 | + | ||
| 3 | +## Features | ||
| 4 | + | ||
| 5 | +- Appclient | ||
| 6 | + - [x] 创建房间: client->createApp() | ||
| 7 | + - [x] 查看房间: client->getApp() | ||
| 8 | + - [x] 删除房间: client->deleteApp() | ||
| 9 | + - [x] 生成房间token: client->appToken() | ||
| 10 | + | ||
| 11 | + | ||
| 12 | + | ||
| 13 | +## Contents | ||
| 14 | + | ||
| 15 | +- [Installation](#installation) | ||
| 16 | +- [Usage](#usage) | ||
| 17 | + - [Configuration](#configuration) | ||
| 18 | + - [App](#app) | ||
| 19 | + - [Create a app](#create-a-app) | ||
| 20 | + - [Get a app](#get-a-app) | ||
| 21 | + - [Delete a app](#delete-a-app) | ||
| 22 | + - [Generate a app token](#generate-a-app-token) | ||
| 23 | + | ||
| 24 | + | ||
| 25 | +## Usage | ||
| 26 | + | ||
| 27 | +### App | ||
| 28 | + | ||
| 29 | +#### Create a app | ||
| 30 | + | ||
| 31 | +```php | ||
| 32 | +$ak = "gwd_gV4gPKZZsmEOvAuNU1AcumicmuHooTfu64q5"; | ||
| 33 | +$sk = "xxxx"; | ||
| 34 | +$auth = new Auth($ak, $sk); | ||
| 35 | +$client = new Qiniu\Rtc\AppClient($auth); | ||
| 36 | +$resp=$client->createApp("901","testApp"); | ||
| 37 | +print_r($resp); | ||
| 38 | +``` | ||
| 39 | + | ||
| 40 | +#### Get an app | ||
| 41 | + | ||
| 42 | +```php | ||
| 43 | +$ak = "gwd_gV4gPKZZsmEOvAuNU1AcumicmuHooTfu64q5"; | ||
| 44 | +$sk = "xxxx"; | ||
| 45 | +$auth = new Auth($ak, $sk); | ||
| 46 | +$client = new Qiniu\Rtc\AppClient($auth); | ||
| 47 | +$resp=$client->getApp("deq02uhb6"); | ||
| 48 | +print_r($resp); | ||
| 49 | +``` | ||
| 50 | + | ||
| 51 | +#### Delete an app | ||
| 52 | + | ||
| 53 | +```php | ||
| 54 | +$ak = "gwd_gV4gPKZZsmEOvAuNU1AcumicmuHooTfu64q5"; | ||
| 55 | +$sk = "xxxx"; | ||
| 56 | +$auth = new Auth($ak, $sk); | ||
| 57 | +$client = new Qiniu\Rtc\AppClient($auth); | ||
| 58 | +$resp=$client->deleteApp("deq02uhb6"); | ||
| 59 | +print_r($resp); | ||
| 60 | +``` | ||
| 61 | + | ||
| 62 | +#### Generate an app token | ||
| 63 | + | ||
| 64 | +```php | ||
| 65 | +$ak = "gwd_gV4gPKZZsmEOvAuNU1AcumicmuHooTfu64q5"; | ||
| 66 | +$sk = "xxxx"; | ||
| 67 | +$auth = new Auth($ak, $sk); | ||
| 68 | +$client = new Qiniu\Rtc\AppClient($auth); | ||
| 69 | +$resp=$client->appToken("deq02uhb6", "lfx", '1111', (time()+3600), 'user'); | ||
| 70 | +print_r($resp); | ||
| 71 | +``` |
vendor/Qiniu/docs/rtc/example.php
0 → 100755
| 1 | +<?php | ||
| 2 | +require_once("../../autoload.php"); | ||
| 3 | + | ||
| 4 | +use \Qiniu\Auth; | ||
| 5 | + | ||
| 6 | +$ak = 'gwd_gV4gPKZZsmEOvAuNU1AcumicmuHooTfu64q5'; | ||
| 7 | +$sk = 'xxxx'; | ||
| 8 | + | ||
| 9 | +$auth = new Auth($ak, $sk); | ||
| 10 | +$client = new Qiniu\Rtc\AppClient($auth); | ||
| 11 | +$hub = 'lfxlive'; | ||
| 12 | +$title = 'lfxl'; | ||
| 13 | +try { | ||
| 14 | + //创建app | ||
| 15 | + $resp = $client->createApp($hub, $title, $maxUsers); | ||
| 16 | + print_r($resp); | ||
| 17 | + // 获取app状态 | ||
| 18 | + $resp = $client->getApp('dgdl5ge8y'); | ||
| 19 | + print_r($resp); | ||
| 20 | + //修改app状态 | ||
| 21 | + $mergePublishRtmp = null; | ||
| 22 | + $mergePublishRtmp['enable'] = true; | ||
| 23 | + $resp = $client->updateApp('dgdl5ge8y', $hub, $title, $maxUsers, $mergePublishRtmp); | ||
| 24 | + print_r($resp); | ||
| 25 | + //删除app | ||
| 26 | + $resp = $client->deleteApp('dgdl5ge8y'); | ||
| 27 | + print_r($resp); | ||
| 28 | + //获取房间连麦的成员 | ||
| 29 | + $resp=$client->listUser("dgbfvvzid", 'lfxl'); | ||
| 30 | + print_r($resp); | ||
| 31 | + //剔除房间的连麦成员 | ||
| 32 | + $resp=$client->kickUser("dgbfvvzid", 'lfx', "qiniu-f6e07b78-4dc8-45fb-a701-a9e158abb8e6"); | ||
| 33 | + print_r($resp); | ||
| 34 | + // 列举房间 | ||
| 35 | + $resp=$client->listActiveRooms("dgbfvvzid", 'lfx', null, null); | ||
| 36 | + print_r($resp); | ||
| 37 | + //鉴权的有效时间: 1个小时. | ||
| 38 | + $resp = $client->appToken("dgd4vecde", "lfxl", '1111', (time()+3600), 'user'); | ||
| 39 | + print_r($resp); | ||
| 40 | +} catch (\Exception $e) { | ||
| 41 | + echo "Error:", $e, "\n"; | ||
| 42 | +} |
vendor/Qiniu/examples/README.md
0 → 100755
| 1 | +# examples | ||
| 2 | + | ||
| 3 | +这些 examples 旨在帮助你快速了解使用七牛的sdk。这些demo都是可以直接运行的, 但是在运行之前需要填上您自己的参数。 | ||
| 4 | + | ||
| 5 | +比如: | ||
| 6 | + | ||
| 7 | +* `$bucket` 需要填上您想操作的 [bucket名字](http://developer.qiniu.com/docs/v6/api/overview/concepts.html#bucket)。 | ||
| 8 | +* `$accessKey` 和 `$secretKey` 可以在我们的[管理后台](https://portal.qiniu.com/setting/key)找到。 | ||
| 9 | +* 在进行`视频转码`, `压缩文件`等异步操作时 需要使用到的队列名称也可以在我们[管理后台](https://portal.qiniu.com/mps/pipeline)新建。 | ||
| 10 | + |
vendor/Qiniu/examples/cdn_get_bandwidth.php
0 → 100755
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +require_once __DIR__ . '/../autoload.php'; | ||
| 4 | + | ||
| 5 | +use \Qiniu\Cdn\CdnManager; | ||
| 6 | + | ||
| 7 | +$accessKey = getenv('QINIU_ACCESS_KEY'); | ||
| 8 | +$secretKey = getenv('QINIU_SECRET_KEY'); | ||
| 9 | + | ||
| 10 | +$auth = new Qiniu\Auth($accessKey, $secretKey); | ||
| 11 | +$cdnManager = new CdnManager($auth); | ||
| 12 | + | ||
| 13 | +//获取流量和带宽数据 | ||
| 14 | +//参考文档:http://developer.qiniu.com/article/fusion/api/traffic-bandwidth.html | ||
| 15 | + | ||
| 16 | +$domains = array( | ||
| 17 | + "javasdk.qiniudn.com", | ||
| 18 | + "phpsdk.qiniudn.com" | ||
| 19 | +); | ||
| 20 | + | ||
| 21 | +$startDate = "2017-08-20"; | ||
| 22 | +$endDate = "2017-08-21"; | ||
| 23 | + | ||
| 24 | +//5min or hour or day | ||
| 25 | +$granularity = "day"; | ||
| 26 | + | ||
| 27 | +//获取带宽数据 | ||
| 28 | +list($bandwidthData, $getBandwidthErr) = $cdnManager->getBandwidthData( | ||
| 29 | + $domains, | ||
| 30 | + $startDate, | ||
| 31 | + $endDate, | ||
| 32 | + $granularity | ||
| 33 | +); | ||
| 34 | + | ||
| 35 | +if ($getBandwidthErr != null) { | ||
| 36 | + var_dump($getBandwidthErr); | ||
| 37 | +} else { | ||
| 38 | + echo "get bandwidth data success\n"; | ||
| 39 | + print_r($bandwidthData); | ||
| 40 | +} |
vendor/Qiniu/examples/cdn_get_flux.php
0 → 100755
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +require_once __DIR__ . '/../autoload.php'; | ||
| 4 | + | ||
| 5 | +use \Qiniu\Cdn\CdnManager; | ||
| 6 | + | ||
| 7 | +$accessKey = getenv('QINIU_ACCESS_KEY'); | ||
| 8 | +$secretKey = getenv('QINIU_SECRET_KEY'); | ||
| 9 | + | ||
| 10 | +$auth = new Qiniu\Auth($accessKey, $secretKey); | ||
| 11 | +$cdnManager = new CdnManager($auth); | ||
| 12 | + | ||
| 13 | +//获取流量和带宽数据 | ||
| 14 | +//参考文档:http://developer.qiniu.com/article/fusion/api/traffic-bandwidth.html | ||
| 15 | + | ||
| 16 | +$domains = array( | ||
| 17 | + "javasdk.qiniudn.com", | ||
| 18 | + "phpsdk.qiniudn.com" | ||
| 19 | +); | ||
| 20 | + | ||
| 21 | +$startDate = "2017-08-20"; | ||
| 22 | +$endDate = "2017-08-21"; | ||
| 23 | + | ||
| 24 | +//5min or hour or day | ||
| 25 | +$granularity = "day"; | ||
| 26 | + | ||
| 27 | +//获取流量数据 | ||
| 28 | +list($fluxData, $getFluxErr) = $cdnManager->getFluxData($domains, $startDate, $endDate, $granularity); | ||
| 29 | +if ($getFluxErr != null) { | ||
| 30 | + var_dump($getFluxErr); | ||
| 31 | +} else { | ||
| 32 | + echo "get flux data success\n"; | ||
| 33 | + print_r($fluxData); | ||
| 34 | +} |
vendor/Qiniu/examples/cdn_get_log_list.php
0 → 100755
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +require_once __DIR__ . '/../autoload.php'; | ||
| 4 | + | ||
| 5 | +use \Qiniu\Cdn\CdnManager; | ||
| 6 | + | ||
| 7 | +$accessKey = getenv('QINIU_ACCESS_KEY'); | ||
| 8 | +$secretKey = getenv('QINIU_SECRET_KEY'); | ||
| 9 | + | ||
| 10 | +$auth = new Qiniu\Auth($accessKey, $secretKey); | ||
| 11 | +$cdnManager = new CdnManager($auth); | ||
| 12 | + | ||
| 13 | +$domains = array( | ||
| 14 | + "javasdk.qiniudn.com", | ||
| 15 | + "phpsdk.qiniudn.com" | ||
| 16 | +); | ||
| 17 | + | ||
| 18 | +$logDate = '2017-08-20'; | ||
| 19 | + | ||
| 20 | +//获取日志下载链接 | ||
| 21 | +//参考文档:http://developer.qiniu.com/article/fusion/api/log.html | ||
| 22 | + | ||
| 23 | +list($logListData, $getLogErr) = $cdnManager->getCdnLogList($domains, $logDate); | ||
| 24 | +if ($getLogErr != null) { | ||
| 25 | + var_dump($getLogErr); | ||
| 26 | +} else { | ||
| 27 | + echo "get cdn log list success\n"; | ||
| 28 | + print_r($logListData); | ||
| 29 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +require_once __DIR__ . '/../autoload.php'; | ||
| 4 | + | ||
| 5 | +use \Qiniu\Cdn\CdnManager; | ||
| 6 | + | ||
| 7 | +$accessKey = getenv('QINIU_ACCESS_KEY'); | ||
| 8 | +$secretKey = getenv('QINIU_SECRET_KEY'); | ||
| 9 | + | ||
| 10 | +$auth = new Qiniu\Auth($accessKey, $secretKey); | ||
| 11 | + | ||
| 12 | +//待刷新的文件列表和目录,文件列表最多一次100个,目录最多一次10个 | ||
| 13 | +//参考文档:http://developer.qiniu.com/article/fusion/api/refresh.html | ||
| 14 | +$urls = array( | ||
| 15 | + "http://phpsdk.qiniudn.com/qiniu.jpg", | ||
| 16 | + "http://phpsdk.qiniudn.com/qiniu2.jpg", | ||
| 17 | +); | ||
| 18 | + | ||
| 19 | +//刷新目录需要联系七牛技术支持开通账户权限 | ||
| 20 | +$dirs = array( | ||
| 21 | + "http://phpsdk.qiniudn.com/test/" | ||
| 22 | +); | ||
| 23 | + | ||
| 24 | +$cdnManager = new CdnManager($auth); | ||
| 25 | + | ||
| 26 | +// 目前客户默认没有目录刷新权限,刷新会有400038报错,参考:https://developer.qiniu.com/fusion/api/1229/cache-refresh | ||
| 27 | +// 需要刷新目录请工单联系技术支持 https://support.qiniu.com/tickets/category | ||
| 28 | +list($refreshResult, $refreshErr) = $cdnManager->refreshUrlsAndDirs($urls, $dirs); | ||
| 29 | +if ($refreshErr != null) { | ||
| 30 | + var_dump($refreshErr); | ||
| 31 | +} else { | ||
| 32 | + echo "refresh request sent\n"; | ||
| 33 | + print_r($refreshResult); | ||
| 34 | +} | ||
| 35 | + | ||
| 36 | +//如果只有刷新链接或者目录的需求,可以分布使用 | ||
| 37 | + | ||
| 38 | +list($refreshResult, $refreshErr) = $cdnManager->refreshUrls($urls); | ||
| 39 | +if ($refreshErr != null) { | ||
| 40 | + var_dump($refreshErr); | ||
| 41 | +} else { | ||
| 42 | + echo "refresh request sent\n"; | ||
| 43 | + print_r($refreshResult); | ||
| 44 | +} | ||
| 45 | + | ||
| 46 | +list($refreshResult, $refreshErr) = $cdnManager->refreshDirs($dirs); | ||
| 47 | +if ($refreshErr != null) { | ||
| 48 | + var_dump($refreshErr); | ||
| 49 | +} else { | ||
| 50 | + echo "refresh request sent\n"; | ||
| 51 | + print_r($refreshResult); | ||
| 52 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +require_once __DIR__ . '/../autoload.php'; | ||
| 4 | + | ||
| 5 | +use \Qiniu\Cdn\CdnManager; | ||
| 6 | + | ||
| 7 | +//创建时间戳防盗链 | ||
| 8 | +//时间戳防盗链密钥,后台获取 | ||
| 9 | +$encryptKey = 'your_domain_timestamp_antileech_encryptkey'; | ||
| 10 | + | ||
| 11 | +//带访问协议的域名 | ||
| 12 | +$url1 = 'http://phpsdk.qiniuts.com/24.jpg?avinfo'; | ||
| 13 | +$url2 = 'http://phpsdk.qiniuts.com/24.jpg'; | ||
| 14 | + | ||
| 15 | +//有效期时间(单位秒) | ||
| 16 | +$durationInSeconds = 3600; | ||
| 17 | + | ||
| 18 | +$signedUrl = CdnManager::createTimestampAntiLeechUrl($url1, $encryptKey, $durationInSeconds); | ||
| 19 | +print($signedUrl); |
vendor/Qiniu/examples/image_url_builder.php
0 → 100755
| 1 | +<?php | ||
| 2 | +require_once __DIR__ . '/../autoload.php'; | ||
| 3 | + | ||
| 4 | +// 引入图片处理类 | ||
| 5 | +use Qiniu\Processing\ImageUrlBuilder; | ||
| 6 | + | ||
| 7 | +$imageUrlBuilder = new ImageUrlBuilder(); | ||
| 8 | + | ||
| 9 | +// 要处理图片 | ||
| 10 | +$url = 'http://78re52.com1.z0.glb.clouddn.com/resource/gogopher.jpg'; | ||
| 11 | +$url2 = 'http://78re52.com1.z0.glb.clouddn.com/resource/gogopher.jpg?watermark/1/gravity/SouthEast/dx/0/dy/0/image/' | ||
| 12 | + . 'aHR0cDovL2Fkcy1jZG4uY2h1Y2h1amllLmNvbS9Ga1R6bnpIY2RLdmRBUFc5cHZZZ3pTc21UY0tB'; | ||
| 13 | +$waterImage = 'http://developer.qiniu.com/resource/logo-2.jpg'; | ||
| 14 | + | ||
| 15 | +/** | ||
| 16 | + * 缩略图链接拼接 | ||
| 17 | + * | ||
| 18 | + * @param string $url 图片链接 | ||
| 19 | + * @param int $mode 缩略模式 | ||
| 20 | + * @param int $width 宽度 | ||
| 21 | + * @param int $height 长度 | ||
| 22 | + * @param string $format 输出类型 [可选] | ||
| 23 | + * @param int $quality 图片质量 [可选] | ||
| 24 | + * @param int $interlace 是否支持渐进显示 [可选] | ||
| 25 | + * @param int $ignoreError 忽略结果 [可选] | ||
| 26 | + * @return string | ||
| 27 | + * @link http://developer.qiniu.com/code/v6/api/kodo-api/image/imageview2.html | ||
| 28 | + * @author Sherlock Ren <sherlock_ren@icloud.com> | ||
| 29 | + */ | ||
| 30 | +$thumbLink = $imageUrlBuilder->thumbnail($url, 1, 100, 100); | ||
| 31 | + | ||
| 32 | +// 函数方式调用 也可拼接多个操作参数 图片+水印 | ||
| 33 | +$thumbLink2 = \Qiniu\thumbnail($url2, 1, 100, 100); | ||
| 34 | +var_dump($thumbLink, $thumbLink2); | ||
| 35 | + | ||
| 36 | +/** | ||
| 37 | + * 图片水印 | ||
| 38 | + * | ||
| 39 | + * @param string $url 图片链接 | ||
| 40 | + * @param string $image 水印图片链接 | ||
| 41 | + * @param numeric $dissolve 透明度 [可选] | ||
| 42 | + * @param string $gravity 水印位置 [可选] | ||
| 43 | + * @param numeric $dx 横轴边距 [可选] | ||
| 44 | + * @param numeric $dy 纵轴边距 [可选] | ||
| 45 | + * @param numeric $watermarkScale 自适应原图的短边比例 [可选] | ||
| 46 | + * @link http://developer.qiniu.com/code/v6/api/kodo-api/image/watermark.html | ||
| 47 | + * @return string | ||
| 48 | + * @author Sherlock Ren <sherlock_ren@icloud.com> | ||
| 49 | + */ | ||
| 50 | +$waterLink = $imageUrlBuilder->waterImg($url, $waterImage); | ||
| 51 | +// 函数调用方法 | ||
| 52 | +//$waterLink = \Qiniu\waterImg($url, $waterImage); | ||
| 53 | +var_dump($waterLink); | ||
| 54 | + | ||
| 55 | +/** | ||
| 56 | + * 文字水印 | ||
| 57 | + * | ||
| 58 | + * @param string $url 图片链接 | ||
| 59 | + * @param string $text 文字 | ||
| 60 | + * @param string $font 文字字体 | ||
| 61 | + * @param string $fontSize 文字字号 | ||
| 62 | + * @param string $fontColor 文字颜色 [可选] | ||
| 63 | + * @param numeric $dissolve 透明度 [可选] | ||
| 64 | + * @param string $gravity 水印位置 [可选] | ||
| 65 | + * @param numeric $dx 横轴边距 [可选] | ||
| 66 | + * @param numeric $dy 纵轴边距 [可选] | ||
| 67 | + * @link http://developer.qiniu.com/code/v6/api/kodo-api/image/watermark.html#text-watermark | ||
| 68 | + * @return string | ||
| 69 | + * @author Sherlock Ren <sherlock_ren@icloud.com> | ||
| 70 | + */ | ||
| 71 | +$textLink = $imageUrlBuilder->waterText($url, '你瞅啥', '微软雅黑', 300); | ||
| 72 | +// 函数调用方法 | ||
| 73 | +// $textLink = \Qiniu\waterText($url, '你瞅啥', '微软雅黑', 300); | ||
| 74 | +var_dump($textLink); |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +require_once __DIR__ . '/../autoload.php'; | ||
| 4 | + | ||
| 5 | +use Qiniu\Auth; | ||
| 6 | +use Qiniu\Processing\PersistentFop; | ||
| 7 | + | ||
| 8 | +$accessKey = 'Access_Key'; | ||
| 9 | +$secretKey = 'Secret_Key'; | ||
| 10 | +$auth = new Auth($accessKey, $secretKey); | ||
| 11 | + | ||
| 12 | +// 要转码的文件所在的空间。 | ||
| 13 | +$bucket = 'Bucket_Name'; | ||
| 14 | + | ||
| 15 | +// 转码是使用的队列名称。 https://portal.qiniu.com/mps/pipeline | ||
| 16 | +$pipeline = 'pipeline_name'; | ||
| 17 | + | ||
| 18 | +// 初始化 | ||
| 19 | +$pfop = new PersistentFop($auth, $bucket, $pipeline); |
vendor/Qiniu/examples/pfop_mkzip.php
0 → 100755
| 1 | +<?php | ||
| 2 | +require_once __DIR__ . '/../autoload.php'; | ||
| 3 | + | ||
| 4 | +use Qiniu\Auth; | ||
| 5 | +use Qiniu\Processing\PersistentFop; | ||
| 6 | + | ||
| 7 | +// 去我们的portal 后台来获取AK, SK | ||
| 8 | +$accessKey = getenv('QINIU_ACCESS_KEY'); | ||
| 9 | +$secretKey = getenv('QINIU_SECRET_KEY'); | ||
| 10 | +$bucket = getenv('QINIU_TEST_BUCKET'); | ||
| 11 | +$key = 'qiniu.png'; | ||
| 12 | + | ||
| 13 | +$auth = new Auth($accessKey, $secretKey); | ||
| 14 | +// 异步任务的队列, 去后台新建: https://portal.qiniu.com/mps/pipeline | ||
| 15 | +$pipeline = 'sdktest'; | ||
| 16 | + | ||
| 17 | +$pfop = new PersistentFop($auth, null); | ||
| 18 | + | ||
| 19 | +// 进行zip压缩的url | ||
| 20 | +$url1 = 'http://phpsdk.qiniudn.com/php-logo.png'; | ||
| 21 | +$url2 = 'http://phpsdk.qiniudn.com/1.png'; | ||
| 22 | + | ||
| 23 | +//压缩后的key | ||
| 24 | +$zipKey = 'test.zip'; | ||
| 25 | + | ||
| 26 | +$fops = 'mkzip/2/url/' . \Qiniu\base64_urlSafeEncode($url1); | ||
| 27 | +$fops .= '/url/' . \Qiniu\base64_urlSafeEncode($url2); | ||
| 28 | +$fops .= '|saveas/' . \Qiniu\base64_urlSafeEncode("$bucket:$zipKey"); | ||
| 29 | + | ||
| 30 | +$notify_url = null; | ||
| 31 | +$force = false; | ||
| 32 | + | ||
| 33 | +list($id, $err) = $pfop->execute($bucket, $key, $fops, $pipeline, $notify_url, $force); | ||
| 34 | + | ||
| 35 | +echo "\n====> pfop mkzip result: \n"; | ||
| 36 | +if ($err != null) { | ||
| 37 | + var_dump($err); | ||
| 38 | +} else { | ||
| 39 | + echo "PersistentFop Id: $id\n"; | ||
| 40 | + | ||
| 41 | + $res = "http://api.qiniu.com/status/get/prefop?id=$id"; | ||
| 42 | + echo "Processing result: $res"; | ||
| 43 | +} |
vendor/Qiniu/examples/pfop_vframe.php
0 → 100755
| 1 | +<?php | ||
| 2 | +require_once __DIR__ . '/../autoload.php'; | ||
| 3 | + | ||
| 4 | +use Qiniu\Auth; | ||
| 5 | +use Qiniu\Processing\PersistentFop; | ||
| 6 | + | ||
| 7 | +//对已经上传到七牛的视频发起异步转码操作 | ||
| 8 | +$accessKey = getenv('QINIU_ACCESS_KEY'); | ||
| 9 | +$secretKey = getenv('QINIU_SECRET_KEY'); | ||
| 10 | +$bucket = getenv('QINIU_TEST_BUCKET'); | ||
| 11 | +$auth = new Auth($accessKey, $secretKey); | ||
| 12 | + | ||
| 13 | +//要转码的文件所在的空间和文件名。 | ||
| 14 | +$key = 'qiniu.mp4'; | ||
| 15 | + | ||
| 16 | +//转码是使用的队列名称。 https://portal.qiniu.com/mps/pipeline | ||
| 17 | +$pipeline = 'sdktest'; | ||
| 18 | + | ||
| 19 | +//转码完成后通知到你的业务服务器。 | ||
| 20 | +$notifyUrl = 'http://375dec79.ngrok.com/notify.php'; | ||
| 21 | +$force = false; | ||
| 22 | + | ||
| 23 | +$config = new \Qiniu\Config(); | ||
| 24 | +$config->useHTTPS = true; | ||
| 25 | +$pfop = new PersistentFop($auth, $config); | ||
| 26 | + | ||
| 27 | +//要进行视频截图操作 | ||
| 28 | +$fops = "vframe/jpg/offset/1/w/480/h/360/rotate/90|saveas/" . | ||
| 29 | + \Qiniu\base64_urlSafeEncode($bucket . ":qiniu_480x360.jpg"); | ||
| 30 | + | ||
| 31 | +list($id, $err) = $pfop->execute($bucket, $key, $fops, $pipeline, $notifyUrl, $force); | ||
| 32 | +echo "\n====> pfop avthumb result: \n"; | ||
| 33 | +if ($err != null) { | ||
| 34 | + var_dump($err); | ||
| 35 | +} else { | ||
| 36 | + echo "PersistentFop Id: $id\n"; | ||
| 37 | +} | ||
| 38 | + | ||
| 39 | +//查询转码的进度和状态 | ||
| 40 | +list($ret, $err) = $pfop->status($id); | ||
| 41 | +echo "\n====> pfop avthumb status: \n"; | ||
| 42 | +if ($err != null) { | ||
| 43 | + var_dump($err); | ||
| 44 | +} else { | ||
| 45 | + var_dump($ret); | ||
| 46 | +} |
vendor/Qiniu/examples/pfop_video_avthumb.php
0 → 100755
| 1 | +<?php | ||
| 2 | +require_once __DIR__ . '/../autoload.php'; | ||
| 3 | + | ||
| 4 | +use Qiniu\Auth; | ||
| 5 | +use Qiniu\Processing\PersistentFop; | ||
| 6 | + | ||
| 7 | +//对已经上传到七牛的视频发起异步转码操作 | ||
| 8 | + | ||
| 9 | +$accessKey = getenv('QINIU_ACCESS_KEY'); | ||
| 10 | +$secretKey = getenv('QINIU_SECRET_KEY'); | ||
| 11 | +$bucket = getenv('QINIU_TEST_BUCKET'); | ||
| 12 | + | ||
| 13 | +$auth = new Auth($accessKey, $secretKey); | ||
| 14 | + | ||
| 15 | +//要转码的文件所在的空间和文件名。 | ||
| 16 | +$key = 'qiniu.mp4'; | ||
| 17 | + | ||
| 18 | +//转码是使用的队列名称。 https://portal.qiniu.com/mps/pipeline | ||
| 19 | +$pipeline = 'sdktest'; | ||
| 20 | +$force = false; | ||
| 21 | + | ||
| 22 | +//转码完成后通知到你的业务服务器。 | ||
| 23 | +$notifyUrl = 'http://375dec79.ngrok.com/notify.php'; | ||
| 24 | +$config = new \Qiniu\Config(); | ||
| 25 | +//$config->useHTTPS=true; | ||
| 26 | + | ||
| 27 | +$pfop = new PersistentFop($auth, $config); | ||
| 28 | + | ||
| 29 | +//要进行转码的转码操作。 http://developer.qiniu.com/docs/v6/api/reference/fop/av/avthumb.html | ||
| 30 | +$fops = "avthumb/mp4/s/640x360/vb/1.4m|saveas/" . \Qiniu\base64_urlSafeEncode($bucket . ":qiniu_640x360.mp4"); | ||
| 31 | + | ||
| 32 | +list($id, $err) = $pfop->execute($bucket, $key, $fops, $pipeline, $notifyUrl, $force); | ||
| 33 | +echo "\n====> pfop avthumb result: \n"; | ||
| 34 | +if ($err != null) { | ||
| 35 | + var_dump($err); | ||
| 36 | +} else { | ||
| 37 | + echo "PersistentFop Id: $id\n"; | ||
| 38 | +} | ||
| 39 | + | ||
| 40 | +//查询转码的进度和状态 | ||
| 41 | +list($ret, $err) = $pfop->status($id); | ||
| 42 | +echo "\n====> pfop avthumb status: \n"; | ||
| 43 | +if ($err != null) { | ||
| 44 | + var_dump($err); | ||
| 45 | +} else { | ||
| 46 | + var_dump($ret); | ||
| 47 | +} |
vendor/Qiniu/examples/pfop_watermark.php
0 → 100755
| 1 | +<?php | ||
| 2 | +require_once __DIR__ . '/../autoload.php'; | ||
| 3 | + | ||
| 4 | +use Qiniu\Auth; | ||
| 5 | +use Qiniu\Processing\PersistentFop; | ||
| 6 | + | ||
| 7 | +//对已经上传到七牛的视频发起异步转码操作 | ||
| 8 | + | ||
| 9 | +$accessKey = getenv('QINIU_ACCESS_KEY'); | ||
| 10 | +$secretKey = getenv('QINIU_SECRET_KEY'); | ||
| 11 | +$bucket = getenv('QINIU_TEST_BUCKET'); | ||
| 12 | + | ||
| 13 | +$auth = new Auth($accessKey, $secretKey); | ||
| 14 | + | ||
| 15 | +//要转码的文件所在的空间和文件名。 | ||
| 16 | +$key = 'qiniu.mp4'; | ||
| 17 | + | ||
| 18 | +//转码是使用的队列名称。 https://portal.qiniu.com/mps/pipeline | ||
| 19 | +$pipeline = 'sdktest'; | ||
| 20 | + | ||
| 21 | +//转码完成后通知到你的业务服务器。 | ||
| 22 | +$notifyUrl = 'http://375dec79.ngrok.com/notify.php'; | ||
| 23 | +$force = false; | ||
| 24 | + | ||
| 25 | +$config = new \Qiniu\Config(); | ||
| 26 | +//$config->useHTTPS=true; | ||
| 27 | +$pfop = new PersistentFop($auth, $config); | ||
| 28 | + | ||
| 29 | +//需要添加水印的图片UrlSafeBase64 | ||
| 30 | +//可以参考http://developer.qiniu.com/code/v6/api/dora-api/av/video-watermark.html | ||
| 31 | +$base64URL = Qiniu\base64_urlSafeEncode('http://devtools.qiniu.com/qiniu.png'); | ||
| 32 | + | ||
| 33 | +//水印参数 | ||
| 34 | +$fops = "avthumb/mp4/s/640x360/vb/1.4m/image/" . $base64URL . "|saveas/" | ||
| 35 | + . \Qiniu\base64_urlSafeEncode($bucket . ":qiniu_wm.mp4"); | ||
| 36 | + | ||
| 37 | +list($id, $err) = $pfop->execute($bucket, $key, $fops, $pipeline, $notifyUrl, $force); | ||
| 38 | +echo "\n====> pfop avthumb result: \n"; | ||
| 39 | +if ($err != null) { | ||
| 40 | + var_dump($err); | ||
| 41 | +} else { | ||
| 42 | + echo "PersistentFop Id: $id\n"; | ||
| 43 | +} | ||
| 44 | + | ||
| 45 | +//查询转码的进度和状态 | ||
| 46 | +list($ret, $err) = $pfop->status($id); | ||
| 47 | +echo "\n====> pfop avthumb status: \n"; | ||
| 48 | +if ($err != null) { | ||
| 49 | + var_dump($err); | ||
| 50 | +} else { | ||
| 51 | + var_dump($ret); | ||
| 52 | +} |
vendor/Qiniu/examples/php-logo.png
0 → 100755
63.5 KB
vendor/Qiniu/examples/prefop.php
0 → 100755
| 1 | +<?php | ||
| 2 | +require_once __DIR__ . '/../autoload.php'; | ||
| 3 | + | ||
| 4 | +use Qiniu\Auth; | ||
| 5 | +use Qiniu\Processing\PersistentFop; | ||
| 6 | + | ||
| 7 | +$accessKey = 'Access_Key'; | ||
| 8 | +$secretKey = 'Secret_Key'; | ||
| 9 | +$auth = new Auth($accessKey, $secretKey); | ||
| 10 | + | ||
| 11 | +//要持久化处理的文件所在的空间和文件名。 | ||
| 12 | +$bucket = 'Bucket_Name'; | ||
| 13 | + | ||
| 14 | +//持久化处理使用的队列名称。 https://portal.qiniu.com/mps/pipeline | ||
| 15 | +$pipeline = 'pipeline_name'; | ||
| 16 | + | ||
| 17 | +//持久化处理完成后通知到你的业务服务器。 | ||
| 18 | +$notifyUrl = 'http://375dec79.ngrok.com/notify.php'; | ||
| 19 | +$pfop = new PersistentFop($auth, $bucket, $pipeline, $notifyUrl); | ||
| 20 | + | ||
| 21 | +$id = "z2.5955c739e3d0041bf80c9baa"; | ||
| 22 | +//查询持久化处理的进度和状态 | ||
| 23 | +list($ret, $err) = $pfop->status($id); | ||
| 24 | +echo "\n====> pfop avthumb status: \n"; | ||
| 25 | +if ($err != null) { | ||
| 26 | + var_dump($err); | ||
| 27 | +} else { | ||
| 28 | + var_dump($ret); | ||
| 29 | +} |
vendor/Qiniu/examples/qetag.php
0 → 100755
| 1 | +<?php | ||
| 2 | +require_once __DIR__ . '/../autoload.php'; | ||
| 3 | + | ||
| 4 | +use \Qiniu\Auth; | ||
| 5 | + | ||
| 6 | +$accessKey = getenv('QINIU_ACCESS_KEY'); | ||
| 7 | +$secretKey = getenv('QINIU_SECRET_KEY'); | ||
| 8 | +$bucket = getenv('QINIU_TEST_BUCKET'); | ||
| 9 | + | ||
| 10 | + | ||
| 11 | +$auth = new Auth($accessKey, $secretKey); | ||
| 12 | +$config = new \Qiniu\Config(); | ||
| 13 | +$bucketManager = new \Qiniu\Storage\BucketManager($auth, $config); | ||
| 14 | + | ||
| 15 | +//每次最多不能超过1000个 | ||
| 16 | +$keyMimePairs = array( | ||
| 17 | + 'qiniu.mp4' => 'video/x-mp4', | ||
| 18 | + 'qiniu.png' => 'image/x-png', | ||
| 19 | + 'qiniu.jpg' => 'image/x-jpg' | ||
| 20 | +); | ||
| 21 | + | ||
| 22 | +$ops = $bucketManager->buildBatchChangeMime($bucket, $keyMimePairs); | ||
| 23 | +list($ret, $err) = $bucketManager->batch($ops); | ||
| 24 | +if ($err) { | ||
| 25 | + print_r($err); | ||
| 26 | +} else { | ||
| 27 | + print_r($ret); | ||
| 28 | +} |
| 1 | +<?php | ||
| 2 | +require_once __DIR__ . '/../autoload.php'; | ||
| 3 | + | ||
| 4 | +use \Qiniu\Auth; | ||
| 5 | + | ||
| 6 | +$accessKey = getenv('QINIU_ACCESS_KEY'); | ||
| 7 | +$secretKey = getenv('QINIU_SECRET_KEY'); | ||
| 8 | +$bucket = getenv('QINIU_TEST_BUCKET'); | ||
| 9 | + | ||
| 10 | + | ||
| 11 | +$auth = new Auth($accessKey, $secretKey); | ||
| 12 | +$config = new \Qiniu\Config(); | ||
| 13 | +$bucketManager = new \Qiniu\Storage\BucketManager($auth, $config); | ||
| 14 | + | ||
| 15 | +//每次最多不能超过1000个 | ||
| 16 | +$keys = array( | ||
| 17 | + 'qiniu.mp4', | ||
| 18 | + 'qiniu.png', | ||
| 19 | + 'qiniu.jpg' | ||
| 20 | +); | ||
| 21 | + | ||
| 22 | +$keyTypePairs = array(); | ||
| 23 | +//type=0表示普通存储,type=1表示低频存储 | ||
| 24 | +foreach ($keys as $key) { | ||
| 25 | + $keyTypePairs[$key] = 1; | ||
| 26 | +} | ||
| 27 | + | ||
| 28 | +$ops = $bucketManager->buildBatchChangeType($bucket, $keyTypePairs); | ||
| 29 | +list($ret, $err) = $bucketManager->batch($ops); | ||
| 30 | +if ($err) { | ||
| 31 | + print_r($err); | ||
| 32 | +} else { | ||
| 33 | + print_r($ret); | ||
| 34 | +} |
vendor/Qiniu/examples/rs_batch_copy.php
0 → 100755
| 1 | +<?php | ||
| 2 | +require_once __DIR__ . '/../autoload.php'; | ||
| 3 | + | ||
| 4 | +use \Qiniu\Auth; | ||
| 5 | + | ||
| 6 | +$accessKey = getenv('QINIU_ACCESS_KEY'); | ||
| 7 | +$secretKey = getenv('QINIU_SECRET_KEY'); | ||
| 8 | +$bucket = getenv('QINIU_TEST_BUCKET'); | ||
| 9 | + | ||
| 10 | + | ||
| 11 | +$auth = new Auth($accessKey, $secretKey); | ||
| 12 | +$config = new \Qiniu\Config(); | ||
| 13 | +$bucketManager = new \Qiniu\Storage\BucketManager($auth, $config); | ||
| 14 | + | ||
| 15 | +//每次最多不能超过1000个 | ||
| 16 | +$keys = array( | ||
| 17 | + 'qiniu.mp4', | ||
| 18 | + 'qiniu.png', | ||
| 19 | + 'qiniu.jpg' | ||
| 20 | +); | ||
| 21 | + | ||
| 22 | +$keyPairs = array(); | ||
| 23 | +foreach ($keys as $key) { | ||
| 24 | + $keyPairs[$key] = $key . "_copy"; | ||
| 25 | +} | ||
| 26 | + | ||
| 27 | +$srcBucket = $bucket; | ||
| 28 | +$destBucket = $bucket; | ||
| 29 | + | ||
| 30 | +$ops = $bucketManager->buildBatchCopy($srcBucket, $keyPairs, $destBucket, true); | ||
| 31 | +list($ret, $err) = $bucketManager->batch($ops); | ||
| 32 | +if ($err) { | ||
| 33 | + print_r($err); | ||
| 34 | +} else { | ||
| 35 | + print_r($ret); | ||
| 36 | +} |
vendor/Qiniu/examples/rs_batch_delete.php
0 → 100755
| 1 | +<?php | ||
| 2 | +require_once __DIR__ . '/../autoload.php'; | ||
| 3 | + | ||
| 4 | +use \Qiniu\Auth; | ||
| 5 | + | ||
| 6 | +$accessKey = getenv('QINIU_ACCESS_KEY'); | ||
| 7 | +$secretKey = getenv('QINIU_SECRET_KEY'); | ||
| 8 | +$bucket = getenv('QINIU_TEST_BUCKET'); | ||
| 9 | + | ||
| 10 | + | ||
| 11 | +$auth = new Auth($accessKey, $secretKey); | ||
| 12 | +$config = new \Qiniu\Config(); | ||
| 13 | +$bucketManager = new \Qiniu\Storage\BucketManager($auth, $config); | ||
| 14 | + | ||
| 15 | +//每次最多不能超过1000个 | ||
| 16 | +$keys = array( | ||
| 17 | + 'qiniu.mp4', | ||
| 18 | + 'qiniu.png', | ||
| 19 | + 'qiniu.jpg' | ||
| 20 | +); | ||
| 21 | + | ||
| 22 | +$ops = $bucketManager->buildBatchDelete($bucket, $keys); | ||
| 23 | +list($ret, $err) = $bucketManager->batch($ops); | ||
| 24 | +if ($err) { | ||
| 25 | + print_r($err); | ||
| 26 | +} else { | ||
| 27 | + print_r($ret); | ||
| 28 | +} |
| 1 | +<?php | ||
| 2 | +require_once __DIR__ . '/../autoload.php'; | ||
| 3 | + | ||
| 4 | +use \Qiniu\Auth; | ||
| 5 | + | ||
| 6 | +$accessKey = getenv('QINIU_ACCESS_KEY'); | ||
| 7 | +$secretKey = getenv('QINIU_SECRET_KEY'); | ||
| 8 | +$bucket = getenv('QINIU_TEST_BUCKET'); | ||
| 9 | + | ||
| 10 | + | ||
| 11 | +$auth = new Auth($accessKey, $secretKey); | ||
| 12 | +$config = new \Qiniu\Config(); | ||
| 13 | +$bucketManager = new \Qiniu\Storage\BucketManager($auth, $config); | ||
| 14 | + | ||
| 15 | +//每次最多不能超过1000个 | ||
| 16 | +$keys = array( | ||
| 17 | + 'qiniu.mp4', | ||
| 18 | + 'qiniu.png', | ||
| 19 | + 'qiniu.jpg' | ||
| 20 | +); | ||
| 21 | + | ||
| 22 | +$keyDayPairs = array(); | ||
| 23 | +//day=0表示永久存储 | ||
| 24 | +foreach ($keys as $key) { | ||
| 25 | + $keyDayPairs[$key] = 0; | ||
| 26 | +} | ||
| 27 | + | ||
| 28 | +$ops = $bucketManager->buildBatchDeleteAfterDays($bucket, $keyDayPairs); | ||
| 29 | +list($ret, $err) = $bucketManager->batch($ops); | ||
| 30 | +if ($err) { | ||
| 31 | + print_r($err); | ||
| 32 | +} else { | ||
| 33 | + print_r($ret); | ||
| 34 | +} |
vendor/Qiniu/examples/rs_batch_move.php
0 → 100755
| 1 | +<?php | ||
| 2 | +require_once __DIR__ . '/../autoload.php'; | ||
| 3 | + | ||
| 4 | +use \Qiniu\Auth; | ||
| 5 | + | ||
| 6 | +$accessKey = getenv('QINIU_ACCESS_KEY'); | ||
| 7 | +$secretKey = getenv('QINIU_SECRET_KEY'); | ||
| 8 | +$bucket = getenv('QINIU_TEST_BUCKET'); | ||
| 9 | + | ||
| 10 | + | ||
| 11 | +$auth = new Auth($accessKey, $secretKey); | ||
| 12 | +$config = new \Qiniu\Config(); | ||
| 13 | +$bucketManager = new \Qiniu\Storage\BucketManager($auth, $config); | ||
| 14 | + | ||
| 15 | +//每次最多不能超过1000个 | ||
| 16 | +$keys = array( | ||
| 17 | + 'qiniu.mp4', | ||
| 18 | + 'qiniu.png', | ||
| 19 | + 'qiniu.jpg' | ||
| 20 | +); | ||
| 21 | + | ||
| 22 | +$keyPairs = array(); | ||
| 23 | +foreach ($keys as $key) { | ||
| 24 | + $keyPairs[$key . "_copy"] = $key . "_move"; | ||
| 25 | +} | ||
| 26 | + | ||
| 27 | +$srcBucket = $bucket; | ||
| 28 | +$destBucket = $bucket; | ||
| 29 | + | ||
| 30 | +$ops = $bucketManager->buildBatchMove($srcBucket, $keyPairs, $destBucket, true); | ||
| 31 | +list($ret, $err) = $bucketManager->batch($ops); | ||
| 32 | +if ($err) { | ||
| 33 | + print_r($err); | ||
| 34 | +} else { | ||
| 35 | + print_r($ret); | ||
| 36 | +} |
vendor/Qiniu/examples/rs_batch_stat.php
0 → 100755
| 1 | +<?php | ||
| 2 | +require_once __DIR__ . '/../autoload.php'; | ||
| 3 | + | ||
| 4 | +use \Qiniu\Auth; | ||
| 5 | + | ||
| 6 | +$accessKey = getenv('QINIU_ACCESS_KEY'); | ||
| 7 | +$secretKey = getenv('QINIU_SECRET_KEY'); | ||
| 8 | +$bucket = getenv('QINIU_TEST_BUCKET'); | ||
| 9 | + | ||
| 10 | + | ||
| 11 | +$auth = new Auth($accessKey, $secretKey); | ||
| 12 | +$config = new \Qiniu\Config(); | ||
| 13 | +$bucketManager = new \Qiniu\Storage\BucketManager($auth, $config); | ||
| 14 | + | ||
| 15 | +//每次最多不能超过1000个 | ||
| 16 | +$keys = array( | ||
| 17 | + 'qiniu.mp4', | ||
| 18 | + 'qiniu.png', | ||
| 19 | + 'qiniu.jpg' | ||
| 20 | +); | ||
| 21 | + | ||
| 22 | +$ops = $bucketManager->buildBatchStat($bucket, $keys); | ||
| 23 | +list($ret, $err) = $bucketManager->batch($ops); | ||
| 24 | +if ($err) { | ||
| 25 | + print_r($err); | ||
| 26 | +} else { | ||
| 27 | + print_r($ret); | ||
| 28 | +} |
vendor/Qiniu/examples/rs_bucket_domains.php
0 → 100755
| 1 | +<?php | ||
| 2 | +require_once __DIR__ . '/../autoload.php'; | ||
| 3 | + | ||
| 4 | +use \Qiniu\Auth; | ||
| 5 | + | ||
| 6 | +$accessKey = getenv('QINIU_ACCESS_KEY'); | ||
| 7 | +$secretKey = getenv('QINIU_SECRET_KEY'); | ||
| 8 | +$bucket = getenv('QINIU_TEST_BUCKET'); | ||
| 9 | + | ||
| 10 | + | ||
| 11 | +$auth = new Auth($accessKey, $secretKey); | ||
| 12 | +$config = new \Qiniu\Config(); | ||
| 13 | +$bucketManager = new \Qiniu\Storage\BucketManager($auth, $config); | ||
| 14 | +list($domains, $err) = $bucketManager->domains($bucket); | ||
| 15 | +if ($err) { | ||
| 16 | + print_r($err); | ||
| 17 | +} else { | ||
| 18 | + print_r($domains); | ||
| 19 | +} |
vendor/Qiniu/examples/rs_buckets.php
0 → 100755
| 1 | +<?php | ||
| 2 | +require_once __DIR__ . '/../autoload.php'; | ||
| 3 | + | ||
| 4 | +use \Qiniu\Auth; | ||
| 5 | + | ||
| 6 | +$accessKey = getenv('QINIU_ACCESS_KEY'); | ||
| 7 | +$secretKey = getenv('QINIU_SECRET_KEY'); | ||
| 8 | +$bucket = getenv('QINIU_TEST_BUCKET'); | ||
| 9 | + | ||
| 10 | + | ||
| 11 | +$auth = new Auth($accessKey, $secretKey); | ||
| 12 | +$config = new \Qiniu\Config(); | ||
| 13 | +$bucketManager = new \Qiniu\Storage\BucketManager($auth, $config); | ||
| 14 | +list($buckets, $err) = $bucketManager->buckets(true); | ||
| 15 | +if ($err) { | ||
| 16 | + print_r($err); | ||
| 17 | +} else { | ||
| 18 | + print_r($buckets); | ||
| 19 | +} |
vendor/Qiniu/examples/rs_change_mime.php
0 → 100755
| 1 | +<?php | ||
| 2 | +require_once __DIR__ . '/../autoload.php'; | ||
| 3 | + | ||
| 4 | +use \Qiniu\Auth; | ||
| 5 | + | ||
| 6 | +$accessKey = getenv('QINIU_ACCESS_KEY'); | ||
| 7 | +$secretKey = getenv('QINIU_SECRET_KEY'); | ||
| 8 | +$bucket = getenv('QINIU_TEST_BUCKET'); | ||
| 9 | + | ||
| 10 | +$key = 'qiniu.mp4'; | ||
| 11 | +$newMime = 'video/x-mp4'; | ||
| 12 | + | ||
| 13 | +$auth = new Auth($accessKey, $secretKey); | ||
| 14 | +$config = new \Qiniu\Config(); | ||
| 15 | +$bucketManager = new \Qiniu\Storage\BucketManager($auth, $config); | ||
| 16 | + | ||
| 17 | +$err = $bucketManager->changeMime($bucket, $key, $newMime); | ||
| 18 | +if ($err) { | ||
| 19 | + print_r($err); | ||
| 20 | +} |
vendor/Qiniu/examples/rs_change_status.php
0 → 100755
| 1 | +<?php | ||
| 2 | +require_once __DIR__ . '/../autoload.php'; | ||
| 3 | + | ||
| 4 | +use \Qiniu\Auth; | ||
| 5 | + | ||
| 6 | +$accessKey = getenv('QINIU_ACCESS_KEY'); | ||
| 7 | +$secretKey = getenv('QINIU_SECRET_KEY'); | ||
| 8 | +$bucket = getenv('QINIU_TEST_BUCKET'); | ||
| 9 | + | ||
| 10 | +$key = "qiniu.jpg"; | ||
| 11 | +$auth = new Auth($accessKey, $secretKey); | ||
| 12 | +$config = new \Qiniu\Config(); | ||
| 13 | +$bucketManager = new \Qiniu\Storage\BucketManager($auth, $config); | ||
| 14 | + | ||
| 15 | +$status = 1;//0表示启用;1表示禁用 | ||
| 16 | + | ||
| 17 | +$err = $bucketManager->changeStatus($bucket, $key, $status); | ||
| 18 | +if ($err) { | ||
| 19 | + print_r($err); | ||
| 20 | +} |
vendor/Qiniu/examples/rs_change_type.php
0 → 100755
| 1 | +<?php | ||
| 2 | +require_once __DIR__ . '/../autoload.php'; | ||
| 3 | + | ||
| 4 | +use \Qiniu\Auth; | ||
| 5 | + | ||
| 6 | +$accessKey = getenv('QINIU_ACCESS_KEY'); | ||
| 7 | +$secretKey = getenv('QINIU_SECRET_KEY'); | ||
| 8 | +$bucket = getenv('QINIU_TEST_BUCKET'); | ||
| 9 | + | ||
| 10 | +$key = "qiniu.mp4"; | ||
| 11 | +$auth = new Auth($accessKey, $secretKey); | ||
| 12 | +$config = new \Qiniu\Config(); | ||
| 13 | +$bucketManager = new \Qiniu\Storage\BucketManager($auth, $config); | ||
| 14 | + | ||
| 15 | +$fileType = 1;//0 表示普通存储,1表示低频存储 | ||
| 16 | + | ||
| 17 | +$err = $bucketManager->changeType($bucket, $key, $fileType); | ||
| 18 | +if ($err) { | ||
| 19 | + print_r($err); | ||
| 20 | +} |
vendor/Qiniu/examples/rs_copy.php
0 → 100755
| 1 | +<?php | ||
| 2 | +require_once __DIR__ . '/../autoload.php'; | ||
| 3 | + | ||
| 4 | +use \Qiniu\Auth; | ||
| 5 | + | ||
| 6 | +$accessKey = getenv('QINIU_ACCESS_KEY'); | ||
| 7 | +$secretKey = getenv('QINIU_SECRET_KEY'); | ||
| 8 | +$bucket = getenv('QINIU_TEST_BUCKET'); | ||
| 9 | + | ||
| 10 | +$key = "qiniu.mp4"; | ||
| 11 | +$auth = new Auth($accessKey, $secretKey); | ||
| 12 | +$config = new \Qiniu\Config(); | ||
| 13 | +$bucketManager = new \Qiniu\Storage\BucketManager($auth, $config); | ||
| 14 | + | ||
| 15 | +$srcBucket = $bucket; | ||
| 16 | +$destBucket = $bucket; | ||
| 17 | +$srcKey = $key; | ||
| 18 | +$destKey = $key . "_copy"; | ||
| 19 | +$err = $bucketManager->copy($srcBucket, $srcKey, $destBucket, $destKey, true); | ||
| 20 | +if ($err) { | ||
| 21 | + print_r($err); | ||
| 22 | +} |
vendor/Qiniu/phpunit.xml.dist
0 → 100755
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<phpunit backupGlobals="false" | ||
| 3 | + backupStaticAttributes="false" | ||
| 4 | + bootstrap="./tests/bootstrap.php" | ||
| 5 | + colors="true" | ||
| 6 | + convertErrorsToExceptions="true" | ||
| 7 | + convertNoticesToExceptions="true" | ||
| 8 | + convertWarningsToExceptions="true" | ||
| 9 | + processIsolation="false" | ||
| 10 | + stopOnFailure="false" | ||
| 11 | + syntaxCheck="true" | ||
| 12 | +> | ||
| 13 | + <testsuites> | ||
| 14 | + <testsuite name="Qiniu SDK Tests"> | ||
| 15 | + <directory>tests</directory> | ||
| 16 | + </testsuite> | ||
| 17 | + </testsuites> | ||
| 18 | + | ||
| 19 | +</phpunit> |
vendor/Qiniu/test-env.sh
0 → 100755
-
Please register or login to post a comment