|
1 |
| -# Qiniu Resource Storage SDK for PHP |
| 1 | +# Qiniu PHP SDK |
| 2 | +[](http://weibo.com/qiniutek) |
| 3 | +[](LICENSE.md) |
| 4 | +[](https://travis-ci.org/qiniu/php-sdk) |
| 5 | +[](https://pypi.python.org/pypi/qiniu) |
| 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 | +## 安装 |
2 | 10 |
|
3 |
| -[](https://travis-ci.org/qiniu/php-sdk) |
| 11 | +1. 通过composer |
| 12 | +```bash |
| 13 | +$ composer require qiniu/php-sdk |
| 14 | +``` |
| 15 | +2. 直接下载安装,SDK 没有依赖其他第三方库,但需要使用composer的autoload |
4 | 16 |
|
5 |
| -[](http://www.qiniu.com/) |
| 17 | +## 运行环境 |
6 | 18 |
|
| 19 | +| Qiniu SDK版本 | PHP 版本 | |
| 20 | +|:--------------------:|:---------------------------:| |
| 21 | +| 7.x | cURL extension, 5.3 - 5.6 | |
| 22 | +| 6.x | cURL extension, 5.2 - 5.6 | |
7 | 23 |
|
8 |
| -## 下载 |
| 24 | +## 使用方法 |
9 | 25 |
|
10 |
| -### 从 release 版本下载 |
| 26 | +### 上传 |
| 27 | +```php |
| 28 | +use Qiniu\Storage\UploadManager; |
| 29 | +use Qiniu\Auth; |
| 30 | +... |
| 31 | + $upManager = new UploadManager(); |
| 32 | + $auth = new Auth($accessKey, $secretKey); |
| 33 | + $token = $auth->uploadToken($bucketName); |
| 34 | + list($ret, $error) = $upManager->put($token, 'formput', 'hello world'); |
| 35 | +... |
| 36 | +``` |
11 | 37 |
|
12 |
| -下载地址:https://github.com/qiniu/php-sdk/releases |
| 38 | +## 测试 |
13 | 39 |
|
14 |
| -这是我们建议的方式,release 版本有版本号,有 [CHANGELOG](https://github.com/qiniu/php-sdk/blob/develop/CHANGELOG.md),使用规格也会比较稳定。 |
| 40 | +``` bash |
| 41 | +$ ./vendor/bin/phpunit tests/Qiniu/Tests/ |
| 42 | +``` |
15 | 43 |
|
16 |
| -### 从 git 库下载 |
| 44 | +## 常见问题 |
17 | 45 |
|
18 |
| -你可以直接用 git clone 下载源代码来使用。但是请注意非 master 分支的代码在规格上可能承受变更,应谨慎使用。 |
| 46 | +- $error保留了请求响应的信息,失败情况下ret 为none, 将$error可以打印出来,提交给我们。 |
| 47 | +- API 的使用 demo 可以参考 [单元测试](https://github.com/qiniu/php-sdk/blob/master/tests)。 |
19 | 48 |
|
| 49 | +## 代码贡献 |
20 | 50 |
|
21 |
| -## 使用 |
| 51 | +详情参考[代码提交指南](https://github.com/qiniu/php-sdk/blob/master/CONTRIBUTING.md)。 |
22 | 52 |
|
23 |
| -参考文档:[七牛云存储 PHP SDK 使用指南](https://github.com/qiniu/php-sdk/tree/develop/docs) |
| 53 | +## 贡献记录 |
24 | 54 |
|
| 55 | +- [所有贡献者](https://github.com/qiniu/php-sdk/contributors) |
25 | 56 |
|
26 |
| -## 贡献代码 |
| 57 | +## 联系我们 |
27 | 58 |
|
28 |
| -1. Fork |
29 |
| -2. 创建您的特性分支 (`git checkout -b my-new-feature`) |
30 |
| -3. 提交您的改动 (`git commit -am 'Added some feature'`) |
31 |
| -4. 将您的修改记录提交到远程 `git` 仓库 (`git push origin my-new-feature`) |
32 |
| -5. 然后到 github 网站的该 `git` 远程仓库的 `my-new-feature` 分支下发起 Pull Request |
| 59 | +- 如果需要帮助,请提交工单(在portal右侧点击咨询和建议提交工单,或者直接向 [email protected] 发送邮件) |
| 60 | +- 如果有什么问题,可以到问答社区提问,[问答社区](http://qiniu.segmentfault.com/) |
| 61 | +- 更详细的文档,见[官方文档站](http://developer.qiniu.com/) |
| 62 | +- 如果发现了bug, 欢迎提交 [issue](https://github.com/qiniu/php-sdk/issues) |
| 63 | +- 如果有功能需求,欢迎提交 [issue](https://github.com/qiniu/php-sdk/issues) |
| 64 | +- 如果要提交代码,欢迎提交 pull request |
| 65 | +- 欢迎关注我们的[微信](http://www.qiniu.com/#weixin) [微博](http://weibo.com/qiniutek),及时获取动态信息。 |
33 | 66 |
|
| 67 | +## 代码许可 |
34 | 68 |
|
35 |
| -## 许可证 |
36 |
| - |
37 |
| -Copyright (c) 2012-2014 qiniu.com |
38 |
| - |
39 |
| -基于 MIT 协议发布: |
40 |
| - |
41 |
| -* [www.opensource.org/licenses/MIT](http://www.opensource.org/licenses/MIT) |
| 69 | +The MIT License (MIT).详情见 [License文件](https://github.com/qiniu/php-sdk/blob/master/LICENSE). |
0 commit comments