An API wrapper for DigitalOcean's Spaces object storage designed for easy use.
Find a file
David Wakelin f1adeb7c07
Merge pull request #74 from juhchamp/master
Add `mimetype` and `privacy` option to `uploadFile` method of `Space`
2022-03-30 11:13:53 +01:00
.github/ISSUE_TEMPLATE Added privacy setting to text upload 2021-10-04 09:35:42 +01:00
docs Moved files now retain the current Object 2022-02-09 09:01:21 +00:00
SpacesAPI uploadFile method of Space class updated and testCanUploadFileWithMimeType method added to SpaceTest. 2022-03-23 16:58:37 -03:00
tests uploadFile method of Space class updated and testCanUploadFileWithMimeType method added to SpaceTest. 2022-03-23 16:58:37 -03:00
.editorconfig Version 3 release. Major re-write 2021-08-09 17:33:50 +01:00
.env.example Version 3 release. Major re-write 2021-08-09 17:33:50 +01:00
.gitignore Version 3 release. Major re-write 2021-08-09 17:33:50 +01:00
.phpdoc-md Version 3 release. Major re-write 2021-08-09 17:33:50 +01:00
composer.json Minor version bump 2022-02-08 18:17:19 +00:00
composer.lock Minor version bump 2022-02-08 18:17:19 +00:00
LICENSE v2: Updates 2020-09-28 15:32:51 +05:30
README.md Added array keys for space and file listing 2021-08-16 16:00:08 +01:00

Spaces-API

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

API reference