• Stars
    star
    176
  • Rank 216,987 (Top 5 %)
  • Language
    PHP
  • License
    MIT License
  • Created about 12 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

UPYUN SDK for PHPer

又拍云 SDK for PHPer

Build Status Scrutinizer Code Quality Code Coverage

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

功能列表

SDK 包含如下功能

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

使用说明

安装

PHP >= 5.5

1.使用 composer 安装

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

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

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

More Repositories

1

slardar

Updating your upstream list and run lua scripts without reloading Nginx.
Lua
494
star
2

lua-resty-checkups

Manage Nginx upstreams in pure Lua.
Lua
259
star
3

upx

UPYUN Storage Command Tool
Go
193
star
4

upyun-resty

UPYUN's open source software for OpenResty development
175
star
5

Android-short-video

Android-short-video 是又拍云推出的一款适用于 Android 平台的短视频 SDK,它包含短视频拍摄、编辑、合成、上传,还包含短视频播放器,再结合又拍云存储和 CDN,您就可以开启您的短视频业务了。
Java
172
star
6

python-sdk

UPYUN Python SDK
Python
115
star
7

java-sdk

UPYUN Java SDK
Java
114
star
8

ios-live-sdk

UPYUN 直播 SDK。播放器、采集器、推流器统一集成,功能完备接口简练,可以快速安装使用。采集与音视频处理模块开源,灵活性强可以满足复杂定制需求。UPYUN 直播平台一站式服务:http://docs.upyun.com/live/
Objective-C
104
star
9

node-sdk

UPYUN SDK for JS(support browser and node.js)
JavaScript
95
star
10

android-player-sdk

UPYUN Android 流媒体播放器
Java
87
star
11

go-sdk

UPYUN Go SDK
Go
76
star
12

android-push-sdk

UPYUN Android 推流 SDK
Java
74
star
13

cafex

Cafex is a pure Elixir implementation of Kafka client
Elixir
69
star
14

wechat-sdk

又拍云微信小程序 SDK
JavaScript
69
star
15

lua-resty-limit-rate

Lua module for limiting request rate for OpenResty/ngx_lua, using the "token bucket" method.
Perl
68
star
16

docs

UPYUN Docs
CSS
66
star
17

android-sdk

UPYUN Android SDK
Java
51
star
18

ios-short-video

ios-short-video 是又拍云推出的一款适用于 iOS 平台的短视频 SDK,它包含短视频拍摄、编辑、合成、上传,还包含短视频播放器,再结合又拍云存储和 CDN,您就可以开启您的短视频业务了。https://www.upyun.com/products/short-video
Objective-C
51
star
19

node-upyun

UPYUN Node.js SDK !!!Deprecated
48
star
20

lua-resty-sync

Synchronizing data based on version changes
Lua
41
star
21

ios-form-sdk

UPYUN iOS SDK
Objective-C
37
star
22

ios-sdk

UPYUN iOS SDK
Objective-C
32
star
23

ruby-sdk

UPYUN Ruby SDK
Ruby
29
star
24

js-multipart-upload

HTML5 multipart-uploader demo
JavaScript
28
star
25

upyun.com

The next generation website
Vue
27
star
26

token-examples

Multilingual token generation example
JavaScript
19
star
27

upyun.github.io

UPYUN Engineering Blog
CSS
18
star
28

ueditor

Integrate UPYUN API to UEditor.
JavaScript
17
star
29

multipart-upload-android-sdk

multipart-upload-android-sdk
Java
15
star
30

discuz-plugin

UPYUN for discuz
PHP
13
star
31

node-av-pretreatment

音视频处理 SDK(Node.js)
JavaScript
11
star
32

c-sdk

UPYUN C SDK
C
10
star
33

js-form-api

表单 API,前端使用的简单 Demo
9
star
34

c-sharp-sdk

UPYUN C-Sharp SDK
C#
8
star
35

upyun-uss-script

Commonly used script for UPYUN Storage Service
Python
8
star
36

multipart-upload-php-sdk

又拍云分块上传 SDK !!! Deprecated
PHP
7
star
37

multipart-upload-ios-sdk

multipart-upload-ios-sdk
Objective-C
7
star
38

erlang-sdk

UPYUN Erlang SDK
Erlang
6
star
39

swift-sdk

又拍云 swift SDK
Swift
5
star
40

Android-QuickLogin

Java
4
star
41

ios-video-player

Objective-C
4
star
42

iOS-QuickLogin

Objective-C
4
star
43

umeditor-for-UPYUN

Integrated UPYUN API to umeditor
JavaScript
3
star
44

av-pretreatment-php-sdk

又拍云音视频预处理 PHP SDK !!! Deprecated
PHP
3
star
45

java-purge-sdk

JAVA version cache refresh for UPYUN
Java
2
star
46

ios-fusion-sdk

UPYUN 融合云 iOS SDK
Objective-C
2
star
47

utilgo

Some awesome go utils
Go
2
star
48

android-fusion-sdk

UPYUN 融合云 Android SDK
Java
1
star
49

carrot

UPYUN scoop packages
PowerShell
1
star
50

rust-sdk

1
star
51

gzjion

multi gz files merge to one
C
1
star