Skip to content

Latest commit

 

History

History
156 lines (79 loc) · 2.14 KB

Spaces.md

File metadata and controls

156 lines (79 loc) · 2.14 KB

SpacesAPI\Spaces

Represents the connection to Digital Ocean spaces.

The entry point for managing spaces.

Instantiate your connection with new \SpacesAPI\Spaces("access-key", "secret-key", "region")

Obtain your access and secret keys from the DigitalOcean Applications & API dashboard

Methods

Name Description
__construct Initialise the API
create Create a new space
list List all your spaces
space Use an existing space

Spaces::__construct

Description

public __construct (string $accessKey, string $secretKey, string $region = "ams3", string $host = "digitaloceanspaces.com)

Initialise the API

Parameters

  • (string) $accessKey : Digital Ocean API access key
  • (string) $secretKey : Digital Ocean API secret key
  • (string) $region : Region, defaults to ams3
  • (string) $host : API endpoint, defaults to digitaloceanspaces.com

Return Values

void

Throws Exceptions

\SpacesAPI\Exceptions\AuthenticationException

Authentication failed


Spaces::create

Description

public create (string $name, bool $public = false)

Create a new space

Parameters

  • (string) $name : The name of the new space
  • (bool) $public : Enable file listing. Default false

Return Values

\SpacesAPI\Space

The newly created space

Throws Exceptions

\SpacesAPI\Exceptions\SpaceExistsException

The named space already exists


Spaces::list

Description

public list (void)

List all your spaces

Parameters

This function has no parameters.

Return Values

array

An array of \SpacesAPI\Space instances indexed by the space name


Spaces::space

Description

public space (string $name)

Use an existing space

Parameters

  • (string) $name : The name of the space

Return Values

\SpacesAPI\Space

The loaded space

Throws Exceptions

\SpacesAPI\Exceptions\SpaceDoesntExistException

The named space doesn't exist