Documentation

Client
in package

Table of Contents

MAX_CHUNK_SIZE  = 1024 * 1024 * 150
THUMBNAIL_FORMAT_JPEG  = 'jpeg'
THUMBNAIL_FORMAT_PNG  = 'png'
THUMBNAIL_SIZE_L  = 'w640h480'
THUMBNAIL_SIZE_M  = 'w128h128'
THUMBNAIL_SIZE_S  = 'w64h64'
THUMBNAIL_SIZE_XL  = 'w1024h768'
THUMBNAIL_SIZE_XS  = 'w32h32'
UPLOAD_SESSION_APPEND  = 1
UPLOAD_SESSION_START  = 0
$accessToken  : string
$client  : Client
$maxChunkSize  : int
$maxUploadChunkRetries  : int
__construct()  : mixed
contentEndpointRequest()  : ResponseInterface
copy()  : array<string|int, mixed>
Copy a file or folder to a different location in the user's Dropbox.
createFolder()  : array<string|int, mixed>
Create a folder at a given path.
createSharedLinkWithSettings()  : mixed
Create a shared link with custom settings.
delete()  : array<string|int, mixed>
Delete the file or folder at a given path.
download()  : resource
Download a file from a user's Dropbox.
getAccessToken()  : string
Get the access token.
getAccountInfo()  : array<string|int, mixed>
Get Account Info for current authenticated user.
getMetadata()  : array<string|int, mixed>
Returns the metadata for a file or folder.
getTemporaryLink()  : string
Get a temporary link to stream content of a file.
getThumbnail()  : string
Get a thumbnail for an image.
listFolder()  : array<string|int, mixed>
Starts returning the contents of a folder.
listFolderContinue()  : array<string|int, mixed>
Once a cursor has been retrieved from list_folder, use this to paginate through all files and retrieve updates to the folder, following the same rules as documented for list_folder.
listSharedLinks()  : array<string|int, mixed>
List shared links.
move()  : array<string|int, mixed>
Move a file or folder to a different location in the user's Dropbox.
revokeToken()  : mixed
Revoke current access token.
rpcEndpointRequest()  : array<string|int, mixed>
search()  : mixed
Search a file or folder in the user's Dropbox.
setAccessToken()  : self
Set the access token.
upload()  : array<string|int, mixed>
Create a new file with the contents provided in the request.
uploadChunked()  : array<string|int, mixed>
Upload file split in chunks. This allows uploading large files, since Dropbox API v2 limits the content size to 150MB.
uploadSessionAppend()  : UploadSessionCursor
Append more data to an upload session.
uploadSessionFinish()  : array<string|int, mixed>
Finish an upload session and save the uploaded data to the given file path.
uploadSessionStart()  : UploadSessionCursor
Upload sessions allow you to upload a single file in one or more requests, for example where the size of the file is greater than 150 MB.
determineException()  : Exception
getEndpointUrl()  : string
getHeaders()  : array<string|int, mixed>
Get the HTTP headers.
getStream()  : PumpStream|Stream
isPipe()  : bool
Check if the contents is a pipe stream (not seekable, no size defined).
normalizePath()  : string
shouldUploadChunked()  : bool
The file should be uploaded in chunks if it size exceeds the 150 MB threshold or if the resource size could not be determined (eg. a popen() stream).
uploadChunk()  : UploadSessionCursor

Constants

MAX_CHUNK_SIZE

public mixed MAX_CHUNK_SIZE = 1024 * 1024 * 150

THUMBNAIL_FORMAT_JPEG

public mixed THUMBNAIL_FORMAT_JPEG = 'jpeg'

THUMBNAIL_FORMAT_PNG

public mixed THUMBNAIL_FORMAT_PNG = 'png'

THUMBNAIL_SIZE_L

public mixed THUMBNAIL_SIZE_L = 'w640h480'

THUMBNAIL_SIZE_M

public mixed THUMBNAIL_SIZE_M = 'w128h128'

THUMBNAIL_SIZE_S

public mixed THUMBNAIL_SIZE_S = 'w64h64'

THUMBNAIL_SIZE_XL

public mixed THUMBNAIL_SIZE_XL = 'w1024h768'

THUMBNAIL_SIZE_XS

public mixed THUMBNAIL_SIZE_XS = 'w32h32'

UPLOAD_SESSION_APPEND

public mixed UPLOAD_SESSION_APPEND = 1

UPLOAD_SESSION_START

public mixed UPLOAD_SESSION_START = 0

Properties

$accessToken

protected string $accessToken

$maxChunkSize

protected int $maxChunkSize

$maxUploadChunkRetries

protected int $maxUploadChunkRetries

Methods

__construct()

public __construct(string $accessToken[, Client|null $client = null ][, int $maxChunkSize = self::MAX_CHUNK_SIZE ], int $maxUploadChunkRetries) : mixed
Parameters
$accessToken : string
$client : Client|null = null
$maxChunkSize : int = self::MAX_CHUNK_SIZE

Set max chunk size per request (determines when to switch from "one shot upload" to upload session and defines chunk size for uploads via session).

$maxUploadChunkRetries : int

How many times to retry an upload session start or append after RequestException.

Return values
mixed

createSharedLinkWithSettings()

Create a shared link with custom settings.

public createSharedLinkWithSettings(string $path[, array<string|int, mixed> $settings = [] ]) : mixed

If no settings are given then the default visibility is RequestedVisibility.public. The resolved visibility, though, may depend on other aspects such as team and shared folder settings). Only for paid users.

Parameters
$path : string
$settings : array<string|int, mixed> = []
Tags
link
https://www.dropbox.com/developers/documentation/http/documentation#sharing-create_shared_link_with_settings
Return values
mixed

getAccessToken()

Get the access token.

public getAccessToken() : string
Return values
string

getThumbnail()

Get a thumbnail for an image.

public getThumbnail(string $path[, string $format = 'jpeg' ][, string $size = 'w64h64' ]) : string

This method currently supports files with the following file extensions: jpg, jpeg, png, tiff, tif, gif and bmp.

Photos that are larger than 20MB in size won't be converted to a thumbnail.

Parameters
$path : string
$format : string = 'jpeg'
$size : string = 'w64h64'
Tags
link
https://www.dropbox.com/developers/documentation/http/documentation#files-get_thumbnail
Return values
string

listFolder()

Starts returning the contents of a folder.

public listFolder([string $path = '' ][, bool $recursive = false ]) : array<string|int, mixed>

If the result's ListFolderResult.has_more field is true, call list_folder/continue with the returned ListFolderResult.cursor to retrieve more entries.

Note: auth.RateLimitError may be returned if multiple list_folder or list_folder/continue calls with same parameters are made simultaneously by same API app for same user. If your app implements retry logic, please hold off the retry until the previous request finishes.

Parameters
$path : string = ''
$recursive : bool = false
Tags
link
https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder
Return values
array<string|int, mixed>

List shared links.

public listSharedLinks([string $path = null ][, bool $direct_only = false ][, string $cursor = null ]) : array<string|int, mixed>

For empty path returns a list of all shared links. For non-empty path returns a list of all shared links with access to the given path.

If direct_only is set true, only direct links to the path will be returned, otherwise it may return link to the path itself and parent folders as described on docs.

Parameters
$path : string = null
$direct_only : bool = false
$cursor : string = null
Tags
link
https://www.dropbox.com/developers/documentation/http/documentation#sharing-list_shared_links
Return values
array<string|int, mixed>

rpcEndpointRequest()

public rpcEndpointRequest(string $endpoint[, array<string|int, mixed> $parameters = null ]) : array<string|int, mixed>
Parameters
$endpoint : string
$parameters : array<string|int, mixed> = null
Return values
array<string|int, mixed>

setAccessToken()

Set the access token.

public setAccessToken(string $accessToken) : self
Parameters
$accessToken : string
Return values
self

upload()

Create a new file with the contents provided in the request.

public upload(string $path, string|resource $contents[, string $mode = 'add' ]) : array<string|int, mixed>

Do not use this to upload a file larger than 150 MB. Instead, create an upload session with upload_session/start.

Parameters
$path : string
$contents : string|resource
$mode : string = 'add'
Tags
link
https://www.dropbox.com/developers/documentation/http/documentation#files-upload
Return values
array<string|int, mixed>

uploadChunked()

Upload file split in chunks. This allows uploading large files, since Dropbox API v2 limits the content size to 150MB.

public uploadChunked(string $path, string|resource $contents[, string $mode = 'add' ][, int $chunkSize = null ]) : array<string|int, mixed>

The chunk size will affect directly the memory usage, so be careful. Large chunks tends to speed up the upload, while smaller optimizes memory usage.

Parameters
$path : string
$contents : string|resource
$mode : string = 'add'
$chunkSize : int = null
Return values
array<string|int, mixed>

uploadSessionAppend()

Append more data to an upload session.

public uploadSessionAppend(string|StreamInterface $contents, UploadSessionCursor $cursor[, bool $close = false ]) : UploadSessionCursor

When the parameter close is set, this call will close the session. A single request should not upload more than 150 MB.

Parameters
$contents : string|StreamInterface
$cursor : UploadSessionCursor
$close : bool = false
Tags
link
https://www.dropbox.com/developers/documentation/http/documentation#files-upload_session-append_v2
Return values
UploadSessionCursor

uploadSessionFinish()

Finish an upload session and save the uploaded data to the given file path.

public uploadSessionFinish(string|StreamInterface $contents, UploadSessionCursor $cursor, string $path[, string|array<string|int, mixed> $mode = 'add' ][, bool $autorename = false ][, bool $mute = false ]) : array<string|int, mixed>

A single request should not upload more than 150 MB.

Parameters
$contents : string|StreamInterface
$cursor : UploadSessionCursor
$path : string
$mode : string|array<string|int, mixed> = 'add'
$autorename : bool = false
$mute : bool = false
Tags
link
https://www.dropbox.com/developers/documentation/http/documentation#files-upload_session-finish
Return values
array<string|int, mixed>

uploadSessionStart()

Upload sessions allow you to upload a single file in one or more requests, for example where the size of the file is greater than 150 MB.

public uploadSessionStart(string|StreamInterface $contents[, bool $close = false ]) : UploadSessionCursor

This call starts a new upload session with the given data.

Parameters
$contents : string|StreamInterface
$close : bool = false
Tags
link
https://www.dropbox.com/developers/documentation/http/documentation#files-upload_session-start
Return values
UploadSessionCursor

getEndpointUrl()

protected getEndpointUrl(string $subdomain, string $endpoint) : string
Parameters
$subdomain : string
$endpoint : string
Return values
string

getHeaders()

Get the HTTP headers.

protected getHeaders([array<string|int, mixed> $headers = [] ]) : array<string|int, mixed>
Parameters
$headers : array<string|int, mixed> = []
Return values
array<string|int, mixed>

isPipe()

Check if the contents is a pipe stream (not seekable, no size defined).

protected isPipe(string|resource $contents) : bool
Parameters
$contents : string|resource
Return values
bool

normalizePath()

protected normalizePath(string $path) : string
Parameters
$path : string
Return values
string

shouldUploadChunked()

The file should be uploaded in chunks if it size exceeds the 150 MB threshold or if the resource size could not be determined (eg. a popen() stream).

protected shouldUploadChunked(string|resource $contents) : bool
Parameters
$contents : string|resource
Return values
bool

Search results