https://github.com/qiniu/php-sdk
Qiniu Resource (Cloud) Storage SDK for PHP
https://github.com/qiniu/php-sdk
Last synced: 10 months ago
JSON representation
Qiniu Resource (Cloud) Storage SDK for PHP
- Host: GitHub
- URL: https://github.com/qiniu/php-sdk
- Owner: qiniu
- License: mit
- Created: 2013-04-17T12:35:00.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2024-10-30T10:23:44.000Z (over 1 year ago)
- Last Synced: 2025-05-05T20:17:42.695Z (10 months ago)
- Language: PHP
- Size: 12 MB
- Stars: 808
- Watchers: 53
- Forks: 424
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-php-cn - Qiniu/sdk - 七牛云资源存储SDK for PHP (配置 Configuration / 第三方api Third Party APIs)
- awesome-php - Qiniu/sdk - Qiniu Resource Storage SDK for PHP (第三方API( Third Party APIs ))
README
# Qiniu Cloud SDK for PHP
[](LICENSE)
[](https://travis-ci.org/qiniu/php-sdk)
[](https://github.com/qiniu/php-sdk/releases)
[](https://packagist.org/packages/qiniu/php-sdk)
[](https://packagist.org/packages/qiniu/php-sdk)
[](https://scrutinizer-ci.com/g/qiniu/php-sdk/?branch=master)
[](https://codecov.io/gh/qiniu/php-sdk)
[](https://gitter.im/qiniu/php-sdk?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[](http://weibo.com/qiniutek)
## 安装
推荐使用 `composer` 进行安装。可以使用 composer.json 声明依赖,或者运行下面的命令。SDK 包已经放到这里 [`qiniu/php-sdk`][install-packagist] 。
```bash
$ composer require qiniu/php-sdk
```
## 运行环境
| Qiniu SDK版本 | PHP 版本 |
|:--------------------:|:-----------------------------------------------:|
| 7.x | cURL extension, 5.3 - 5.6, 7.0 - 7.4, 8.0-8.1 |
| 6.x | cURL extension, 5.2 - 5.6 |
## 使用方法
### 上传
```php
use Qiniu\Storage\UploadManager;
use Qiniu\Auth;
...
$uploadMgr = new UploadManager();
$auth = new Auth($accessKey, $secretKey);
$token = $auth->uploadToken($bucket);
list($ret, $error) = $uploadMgr->putFile($token, 'key', 'filePath');
...
```
## 测试
``` bash
$ ./vendor/bin/phpunit tests/Qiniu/Tests/
```
## 常见问题
- `$error` 保留了请求响应的信息,失败情况下 `ret` 为 `none`, 将 `$error` 可以打印出来,提交给我们。
- API 的使用 demo 可以参考 [examples](https://github.com/qiniu/php-sdk/tree/master/examples)。
## 代码贡献
详情参考[代码提交指南](https://github.com/qiniu/php-sdk/blob/master/CONTRIBUTING.md)。
## 贡献记录
- [所有贡献者](https://github.com/qiniu/php-sdk/contributors)
## 联系我们
- 如果需要帮助,请提交工单(在portal右侧点击咨询和建议提交工单,或者直接向 support@qiniu.com 发送邮件)
- 如果有什么问题,可以到问答社区提问,[问答社区](https://qiniu.segmentfault.com/)
- 更详细的文档,见[官方文档站](https://developer.qiniu.com/)
- 如果发现了 bug, 欢迎提交 [issue](https://github.com/qiniu/php-sdk/issues)
- 如果有功能需求,欢迎提交 [issue](https://github.com/qiniu/php-sdk/issues)
- 如果要提交代码,欢迎提交 pull request
- 欢迎关注我们的[微信](https://www.qiniu.com/#weixin) [微博](https://weibo.com/qiniutek),及时获取动态信息。
## 代码许可
The MIT License (MIT).详情见 [License文件](https://github.com/qiniu/php-sdk/blob/master/LICENSE).
[packagist]: http://packagist.org
[install-packagist]: https://packagist.org/packages/qiniu/php-sdk