sociallydev / spaces-api
访问Digital Ocean spaces的库
3.6.1
2023-12-15 11:07 UTC
Requires
- php: >=7.3
- aws/aws-sdk-php: ^3.52
Requires (Dev)
- clean/phpdoc-md: ^0.19.1
- phpunit/phpunit: ^9.5.13
- vlucas/phpdotenv: ^v5.4.1
README
所有问题都将被关闭,新的PR将不接受
安装
通过composer安装
composer require sociallydev/spaces-api
快速开始
从Digital Ocean应用程序与API仪表板获取API密钥
use SpacesAPI\Spaces; // Connect to a space $spaces = new Spaces('api-key', 'api-secret'); $space = $spaces->space('space-name'); // Download a file $file = $space->file('remote-file-1.txt'); $file->download('local/file/path/file.txt'); // Upload text to a file $file2 = $space->uploadText("Lorem ipsum","remote-file-2.txt"); // Get a signed public link, valid for 2 hours $file2url = $file2->getSignedURL("2 hours"); // Make a copy $file3 = $file2->copy('remote-file-3.txt'); // Move or rename a file $file2->move('new-filename.txt') // Make a file public and get the URL $file3->makePublic(); $file3url = $file3->getURL();
更多示例请参阅docs/Examples.md
升级了吗?
版本3相对于版本2有很多变化,因此我们编写了迁移指南