mirror of
https://github.com/SociallyDev/Spaces-API.git
synced 2025-07-14 09:03:02 -07:00
An API wrapper for DigitalOcean's Spaces object storage designed for easy use.
Bumps [guzzlehttp/psr7](https://github.com/guzzle/psr7) from 2.1.0 to 2.2.1. - [Release notes](https://github.com/guzzle/psr7/releases) - [Changelog](https://github.com/guzzle/psr7/blob/master/CHANGELOG.md) - [Commits](https://github.com/guzzle/psr7/compare/2.1.0...2.2.1) --- updated-dependencies: - dependency-name: guzzlehttp/psr7 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> |
||
---|---|---|
.github/ISSUE_TEMPLATE | ||
docs | ||
SpacesAPI | ||
tests | ||
.editorconfig | ||
.env.example | ||
.gitignore | ||
.phpdoc-md | ||
composer.json | ||
composer.lock | ||
LICENSE | ||
README.md |
PHP library for accessing Digital Ocean spaces
Installation
Install via composer
composer require sociallydev/spaces-api
Quick start
Obtain API keys from the Digital Ocean Applications & API dashboard
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');
// Make a file public and get the URL
$file3->makePublic();
$file3url = $file3->getURL();
See more examples in docs/Examples.md
Upgrading?
Version 3 has many changes over version 2, so we have written a migration guide