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
Name | Description |
---|---|
__construct | Initialise the API |
create | Create a new space |
list | List all your spaces |
space | Use an existing space |
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 toams3
(string) $host
: API endpoint, defaults todigitaloceanspaces.com
Return Values
void
Throws Exceptions
\SpacesAPI\Exceptions\AuthenticationException
Authentication failed
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. Defaultfalse
Return Values
\SpacesAPI\Space
The newly created space
Throws Exceptions
\SpacesAPI\Exceptions\SpaceExistsException
The named space already exists
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
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