1 Star 0 Fork 0

姜大年 / php-sdk

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

又拍云 SDK for PHPer

Build Status Scrutinizer Code Quality Code Coverage

又拍云 PHP SDK,封装了又拍云功能丰富的开放 API ,帮助开发者快速对接文件云端存储、图片音视频云处理、智能鉴黄等功能

功能列表

SDK 包含如下功能

功能列表中的异步操作,均可以设置异步回调通知地址,接收异步处理结果 如果需要测试回调功能,可以通过又拍云回调服务创建一个临时回调地址

使用说明

安装

PHP >= 5.5

1.使用 composer 安装

推荐使用该方法安装,成为优雅的 PHPer :fire:

建议使用速度很快的国内全量镜像(又拍云赞助)

composer require upyun/sdk

2.如果不适应 composer 管理,可以直接下载压缩包(注意需要下载 php-sdk-版本号.zip 格式的 zip 压缩包,不是 Source code 源码压缩包),解压后,项目中添加如下代码:

require_once '/path/to/php-sdk/vendor/autoload.php';

文档

详细文档见 doc.md

示例

先初始化又拍云服务配置:

require_once('vendor/autoload.php'); // 只针对使用 composer 安装
// require_once '/path/to/php-sdk/vendor/autoload.php'; // 针对压缩包安装

use Upyun\Upyun;
use Upyun\Config;
$serviceConfig = new Config('yourServiceName', 'yourOperatorName', 'yourOperatorPwd');
$client = new Upyun($serviceConfig);

字符串写入又拍云服务器

$client->write('/save/path', 'file content');

文件流写入又拍云服务器

$file = fopen('/local/path/file', 'r');
$client->write('/save/path', $file);

使用并行式断点续传上传文件

$serviceConfig->setUploadType('BLOCK_PARALLEL');
$client = new Upyun($serviceConfig);
$file = fopen('/local/path/file', 'r');
$client->write('/save/path', $file);

上传图片并转换格式为 png,详见上传作图

$file = fopen('/local/path/image.jpg', 'r');
$client->write('/save/image.png', $file, array('x-gmkerl-thumb' => '/format/png'));

下载文件并保存到本地

$saveLocal = fopen('/local/path/image.jpg', 'w');
// 第二个参数不传时,read 方法将直接返回文件内容
$client->read('/remote/server/image.png', $saveLocal);

贡献代码

  1. Fork
  2. 为新特性创建一个新的分支
  3. 发送一个 pull request 到 master 分支

社区

许可证

UPYUN PHP-SDK 基于 MIT 开源协议

http://www.opensource.org/licenses/MIT

Copyright (c) 2016 UPYUN Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

暂无描述 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/soul123/php-sdk.git
git@gitee.com:soul123/php-sdk.git
soul123
php-sdk
php-sdk
master

搜索帮助