An API wrapper for DigitalOcean's Spaces object storage designed for easy use.
Go to file
2023-12-15 11:07:08 +00:00
.github/ISSUE_TEMPLATE Updated version numbers in github bug report template 2022-03-30 11:27:01 +01:00
docs Allowed passing validation flag to Space::file() 2022-11-11 09:55:47 +00:00
SpacesAPI Fixed hardcoded region in Spaces constructor 2023-12-15 10:30:35 +00:00
tests Added extra test assertion for Space::uploadFile mimeType argument 2022-03-30 11:21:42 +01: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 Version bump from bugfix 2023-12-15 11:06:58 +00:00
composer.lock Allowed passing validation flag to Space::file() 2022-11-11 09:55:47 +00:00
LICENSE v2: Updates 2020-09-28 15:32:51 +05:30
README.md Added deprecation notice 2023-12-15 11:07:08 +00:00

This library is deprecated

We recommend using the official SDK or the Laravel package

All issues will be closed and new PRs will not be accepted

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');

// Move or rename a file
$file2->move('new-filename.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