\OSSOssClient

Class OssClient

Object Storage Service(OSS)'s client class, which wraps all OSS APIs user could call to talk to OSS. Users could do operations on bucket, object, including MultipartUpload or setting ACL via an OSSClient instance. For more details, please check out the OSS API document:https://www.alibabacloud.com/help/doc-detail/31947.htm

Summary

Methods
Properties
Constants
__construct()
listBuckets()
createBucket()
deleteBucket()
doesBucketExist()
getBucketLocation()
getBucketMeta()
getBucketAcl()
putBucketAcl()
getObjectAcl()
putObjectAcl()
getBucketLogging()
putBucketLogging()
deleteBucketLogging()
putBucketWebsite()
getBucketWebsite()
deleteBucketWebsite()
putBucketCors()
getBucketCors()
deleteBucketCors()
addBucketCname()
getBucketCname()
deleteBucketCname()
putBucketLiveChannel()
putLiveChannelStatus()
getLiveChannelInfo()
getLiveChannelStatus()
getLiveChannelHistory()
listBucketLiveChannels()
postVodPlaylist()
deleteBucketLiveChannel()
signRtmpUrl()
generatePresignedRtmpUrl()
optionsObject()
putBucketLifecycle()
getBucketLifecycle()
deleteBucketLifecycle()
putBucketReferer()
getBucketReferer()
putBucketStorageCapacity()
getBucketStorageCapacity()
getBucketInfo()
getBucketStat()
putBucketPolicy()
getBucketPolicy()
deleteBucketPolicy()
putBucketEncryption()
getBucketEncryption()
deleteBucketEncryption()
putBucketRequestPayment()
getBucketRequestPayment()
putBucketTags()
getBucketTags()
deleteBucketTags()
putBucketVersioning()
getBucketVersioning()
initiateBucketWorm()
abortBucketWorm()
completeBucketWorm()
extendBucketWorm()
getBucketWorm()
listObjects()
listObjectVersions()
createObjectDir()
putObject()
putSymlink()
getSymlink()
uploadFile()
uploadStream()
appendObject()
appendFile()
copyObject()
getObjectMeta()
getSimplifiedObjectMeta()
deleteObject()
deleteObjects()
deleteObjectVersions()
getObject()
doesObjectExist()
restoreObject()
putObjectTagging()
getObjectTagging()
deleteObjectTagging()
processObject()
generateMultiuploadParts()
initiateMultipartUpload()
uploadPart()
listParts()
abortMultipartUpload()
completeMultipartUpload()
listMultipartUploads()
uploadPartCopy()
multiuploadFile()
uploadDir()
signUrl()
generatePresignedUrl()
setMaxTries()
getMaxRetries()
setSignStsInUrl()
isUseSSL()
setUseSSL()
checkEnv()
setTimeout()
setConnectTimeout()
$OSS_ACL_TYPES
OSS_LIFECYCLE_EXPIRATION
OSS_LIFECYCLE_TIMING_DAYS
OSS_LIFECYCLE_TIMING_DATE
OSS_BUCKET
OSS_OBJECT
OSS_HEADERS
OSS_METHOD
OSS_QUERY
OSS_BASENAME
OSS_MAX_KEYS
OSS_UPLOAD_ID
OSS_PART_NUM
OSS_COMP
OSS_LIVE_CHANNEL_STATUS
OSS_LIVE_CHANNEL_START_TIME
OSS_LIVE_CHANNEL_END_TIME
OSS_POSITION
OSS_MAX_KEYS_VALUE
OSS_MAX_OBJECT_GROUP_VALUE
OSS_MAX_PART_SIZE
OSS_MID_PART_SIZE
OSS_MIN_PART_SIZE
OSS_FILE_SLICE_SIZE
OSS_PREFIX
OSS_DELIMITER
OSS_MARKER
OSS_ACCEPT_ENCODING
OSS_CONTENT_MD5
OSS_SELF_CONTENT_MD5
OSS_CONTENT_TYPE
OSS_CONTENT_LENGTH
OSS_IF_MODIFIED_SINCE
OSS_IF_UNMODIFIED_SINCE
OSS_IF_MATCH
OSS_IF_NONE_MATCH
OSS_CACHE_CONTROL
OSS_EXPIRES
OSS_PREAUTH
OSS_CONTENT_COING
OSS_CONTENT_DISPOSTION
OSS_RANGE
OSS_ETAG
OSS_LAST_MODIFIED
OS_CONTENT_RANGE
OSS_CONTENT
OSS_BODY
OSS_LENGTH
OSS_HOST
OSS_DATE
OSS_AUTHORIZATION
OSS_FILE_DOWNLOAD
OSS_FILE_UPLOAD
OSS_PART_SIZE
OSS_SEEK_TO
OSS_SIZE
OSS_QUERY_STRING
OSS_SUB_RESOURCE
OSS_DEFAULT_PREFIX
OSS_CHECK_MD5
DEFAULT_CONTENT_TYPE
OSS_SYMLINK_TARGET
OSS_SYMLINK
OSS_HTTP_CODE
OSS_REQUEST_ID
OSS_INFO
OSS_STORAGE
OSS_RESTORE
OSS_STORAGE_STANDARD
OSS_STORAGE_IA
OSS_STORAGE_ARCHIVE
OSS_STORAGE_COLDARCHIVE
OSS_TAGGING
OSS_WORM_ID
OSS_RESTORE_CONFIG
OSS_KEY_MARKER
OSS_VERSION_ID_MARKER
OSS_VERSION_ID
OSS_HEADER_VERSION_ID
OSS_URL_ACCESS_KEY_ID
OSS_URL_EXPIRES
OSS_URL_SIGNATURE
OSS_HTTP_GET
OSS_HTTP_PUT
OSS_HTTP_HEAD
OSS_HTTP_POST
OSS_HTTP_DELETE
OSS_HTTP_OPTIONS
OSS_ACL
OSS_OBJECT_ACL
OSS_OBJECT_GROUP
OSS_MULTI_PART
OSS_MULTI_DELETE
OSS_OBJECT_COPY_SOURCE
OSS_OBJECT_COPY_SOURCE_RANGE
OSS_PROCESS
OSS_CALLBACK
OSS_CALLBACK_VAR
OSS_REQUEST_PAYER
OSS_TRAFFIC_LIMIT
OSS_SECURITY_TOKEN
OSS_ACL_TYPE_PRIVATE
OSS_ACL_TYPE_PUBLIC_READ
OSS_ACL_TYPE_PUBLIC_READ_WRITE
OSS_ENCODING_TYPE
OSS_ENCODING_TYPE_URL
OSS_HOST_TYPE_NORMAL
OSS_HOST_TYPE_IP
OSS_HOST_TYPE_SPECIAL
OSS_HOST_TYPE_CNAME
OSS_NAME
OSS_VERSION
OSS_BUILD
OSS_AUTHOR
OSS_OPTIONS_ORIGIN
OSS_OPTIONS_REQUEST_METHOD
OSS_OPTIONS_REQUEST_HEADERS
No protected methods found
No protected properties found
N/A
computePartSize()
precheckOptions()
precheckBucket()
precheckObject()
precheckStorage()
precheckCommon()
precheckParam()
isCheckMD5()
getValue()
getMimeType()
auth()
authPrecheckBucket()
authPrecheckObject()
authPrecheckObjectEncoding()
authPrecheckAcl()
generateHostname()
generateResourceUri()
generateSignableQueryStringParam()
generateSignableResource()
generateQueryString()
stringToSignSorted()
generateHeaders()
generateUserAgent()
checkEndpoint()
$useSSL
$maxRetries
$redirects
$hostType
$requestProxy
$accessKeyId
$accessKeySecret
$hostname
$securityToken
$enableStsInUrl
$timeout
$connectTimeout
N/A

Constants

OSS_LIFECYCLE_EXPIRATION

OSS_LIFECYCLE_EXPIRATION = "Expiration"

OSS_LIFECYCLE_TIMING_DAYS

OSS_LIFECYCLE_TIMING_DAYS = "Days"

OSS_LIFECYCLE_TIMING_DATE

OSS_LIFECYCLE_TIMING_DATE = "Date"

OSS_BUCKET

OSS_BUCKET = 'bucket'

OSS_OBJECT

OSS_OBJECT = 'object'

OSS_HEADERS

OSS_HEADERS = \OSS\Core\OssUtil::OSS_HEADERS

OSS_METHOD

OSS_METHOD = 'method'

OSS_QUERY

OSS_QUERY = 'query'

OSS_BASENAME

OSS_BASENAME = 'basename'

OSS_MAX_KEYS

OSS_MAX_KEYS = 'max-keys'

OSS_UPLOAD_ID

OSS_UPLOAD_ID = 'uploadId'

OSS_PART_NUM

OSS_PART_NUM = 'partNumber'

OSS_COMP

OSS_COMP = 'comp'

OSS_LIVE_CHANNEL_STATUS

OSS_LIVE_CHANNEL_STATUS = 'status'

OSS_LIVE_CHANNEL_START_TIME

OSS_LIVE_CHANNEL_START_TIME = 'startTime'

OSS_LIVE_CHANNEL_END_TIME

OSS_LIVE_CHANNEL_END_TIME = 'endTime'

OSS_POSITION

OSS_POSITION = 'position'

OSS_MAX_KEYS_VALUE

OSS_MAX_KEYS_VALUE = 100

OSS_MAX_OBJECT_GROUP_VALUE

OSS_MAX_OBJECT_GROUP_VALUE = \OSS\Core\OssUtil::OSS_MAX_OBJECT_GROUP_VALUE

OSS_MAX_PART_SIZE

OSS_MAX_PART_SIZE = \OSS\Core\OssUtil::OSS_MAX_PART_SIZE

OSS_MID_PART_SIZE

OSS_MID_PART_SIZE = \OSS\Core\OssUtil::OSS_MID_PART_SIZE

OSS_MIN_PART_SIZE

OSS_MIN_PART_SIZE = \OSS\Core\OssUtil::OSS_MIN_PART_SIZE

OSS_FILE_SLICE_SIZE

OSS_FILE_SLICE_SIZE = 8192

OSS_PREFIX

OSS_PREFIX = 'prefix'

OSS_DELIMITER

OSS_DELIMITER = 'delimiter'

OSS_MARKER

OSS_MARKER = 'marker'

OSS_ACCEPT_ENCODING

OSS_ACCEPT_ENCODING = 'Accept-Encoding'

OSS_CONTENT_MD5

OSS_CONTENT_MD5 = 'Content-Md5'

OSS_SELF_CONTENT_MD5

OSS_SELF_CONTENT_MD5 = 'x-oss-meta-md5'

OSS_CONTENT_TYPE

OSS_CONTENT_TYPE = 'Content-Type'

OSS_CONTENT_LENGTH

OSS_CONTENT_LENGTH = 'Content-Length'

OSS_IF_MODIFIED_SINCE

OSS_IF_MODIFIED_SINCE = 'If-Modified-Since'

OSS_IF_UNMODIFIED_SINCE

OSS_IF_UNMODIFIED_SINCE = 'If-Unmodified-Since'

OSS_IF_MATCH

OSS_IF_MATCH = 'If-Match'

OSS_IF_NONE_MATCH

OSS_IF_NONE_MATCH = 'If-None-Match'

OSS_CACHE_CONTROL

OSS_CACHE_CONTROL = 'Cache-Control'

OSS_EXPIRES

OSS_EXPIRES = 'Expires'

OSS_PREAUTH

OSS_PREAUTH = 'preauth'

OSS_CONTENT_COING

OSS_CONTENT_COING = 'Content-Coding'

OSS_CONTENT_DISPOSTION

OSS_CONTENT_DISPOSTION = 'Content-Disposition'

OSS_RANGE

OSS_RANGE = 'range'

OSS_ETAG

OSS_ETAG = 'etag'

OSS_LAST_MODIFIED

OSS_LAST_MODIFIED = 'lastmodified'

OS_CONTENT_RANGE

OS_CONTENT_RANGE = 'Content-Range'

OSS_CONTENT

OSS_CONTENT = \OSS\Core\OssUtil::OSS_CONTENT

OSS_BODY

OSS_BODY = 'body'

OSS_LENGTH

OSS_LENGTH = \OSS\Core\OssUtil::OSS_LENGTH

OSS_HOST

OSS_HOST = 'Host'

OSS_DATE

OSS_DATE = 'Date'

OSS_AUTHORIZATION

OSS_AUTHORIZATION = 'Authorization'

OSS_FILE_DOWNLOAD

OSS_FILE_DOWNLOAD = 'fileDownload'

OSS_FILE_UPLOAD

OSS_FILE_UPLOAD = 'fileUpload'

OSS_PART_SIZE

OSS_PART_SIZE = 'partSize'

OSS_SEEK_TO

OSS_SEEK_TO = 'seekTo'

OSS_SIZE

OSS_SIZE = 'size'

OSS_QUERY_STRING

OSS_QUERY_STRING = 'query_string'

OSS_SUB_RESOURCE

OSS_SUB_RESOURCE = 'sub_resource'

OSS_DEFAULT_PREFIX

OSS_DEFAULT_PREFIX = 'x-oss-'

OSS_CHECK_MD5

OSS_CHECK_MD5 = 'checkmd5'

DEFAULT_CONTENT_TYPE

DEFAULT_CONTENT_TYPE = 'application/octet-stream'

OSS_HTTP_CODE

OSS_HTTP_CODE = 'http_code'

OSS_REQUEST_ID

OSS_REQUEST_ID = 'x-oss-request-id'

OSS_INFO

OSS_INFO = 'info'

OSS_STORAGE

OSS_STORAGE = 'storage'

OSS_RESTORE

OSS_RESTORE = 'restore'

OSS_STORAGE_STANDARD

OSS_STORAGE_STANDARD = 'Standard'

OSS_STORAGE_IA

OSS_STORAGE_IA = 'IA'

OSS_STORAGE_ARCHIVE

OSS_STORAGE_ARCHIVE = 'Archive'

OSS_STORAGE_COLDARCHIVE

OSS_STORAGE_COLDARCHIVE = 'ColdArchive'

OSS_TAGGING

OSS_TAGGING = 'tagging'

OSS_WORM_ID

OSS_WORM_ID = 'wormId'

OSS_RESTORE_CONFIG

OSS_RESTORE_CONFIG = 'restore-config'

OSS_KEY_MARKER

OSS_KEY_MARKER = 'key-marker'

OSS_VERSION_ID_MARKER

OSS_VERSION_ID_MARKER = 'version-id-marker'

OSS_VERSION_ID

OSS_VERSION_ID = 'versionId'

OSS_HEADER_VERSION_ID

OSS_HEADER_VERSION_ID = 'x-oss-version-id'

OSS_URL_ACCESS_KEY_ID

OSS_URL_ACCESS_KEY_ID = 'OSSAccessKeyId'

OSS_URL_EXPIRES

OSS_URL_EXPIRES = 'Expires'

OSS_URL_SIGNATURE

OSS_URL_SIGNATURE = 'Signature'

OSS_HTTP_GET

OSS_HTTP_GET = 'GET'

OSS_HTTP_PUT

OSS_HTTP_PUT = 'PUT'

OSS_HTTP_HEAD

OSS_HTTP_HEAD = 'HEAD'

OSS_HTTP_POST

OSS_HTTP_POST = 'POST'

OSS_HTTP_DELETE

OSS_HTTP_DELETE = 'DELETE'

OSS_HTTP_OPTIONS

OSS_HTTP_OPTIONS = 'OPTIONS'

OSS_ACL

OSS_ACL = 'x-oss-acl'

OSS_OBJECT_ACL

OSS_OBJECT_ACL = 'x-oss-object-acl'

OSS_OBJECT_GROUP

OSS_OBJECT_GROUP = 'x-oss-file-group'

OSS_MULTI_PART

OSS_MULTI_PART = 'uploads'

OSS_MULTI_DELETE

OSS_MULTI_DELETE = 'delete'

OSS_OBJECT_COPY_SOURCE

OSS_OBJECT_COPY_SOURCE = 'x-oss-copy-source'

OSS_OBJECT_COPY_SOURCE_RANGE

OSS_OBJECT_COPY_SOURCE_RANGE = "x-oss-copy-source-range"

OSS_PROCESS

OSS_PROCESS = "x-oss-process"

OSS_CALLBACK

OSS_CALLBACK = "x-oss-callback"

OSS_CALLBACK_VAR

OSS_CALLBACK_VAR = "x-oss-callback-var"

OSS_REQUEST_PAYER

OSS_REQUEST_PAYER = "x-oss-request-payer"

OSS_TRAFFIC_LIMIT

OSS_TRAFFIC_LIMIT = "x-oss-traffic-limit"

OSS_SECURITY_TOKEN

OSS_SECURITY_TOKEN = "x-oss-security-token"

OSS_ACL_TYPE_PRIVATE

OSS_ACL_TYPE_PRIVATE = 'private'

OSS_ACL_TYPE_PUBLIC_READ

OSS_ACL_TYPE_PUBLIC_READ = 'public-read'

OSS_ACL_TYPE_PUBLIC_READ_WRITE

OSS_ACL_TYPE_PUBLIC_READ_WRITE = 'public-read-write'

OSS_ENCODING_TYPE

OSS_ENCODING_TYPE = "encoding-type"

OSS_ENCODING_TYPE_URL

OSS_ENCODING_TYPE_URL = "url"

OSS_HOST_TYPE_NORMAL

OSS_HOST_TYPE_NORMAL = "normal"

OSS_HOST_TYPE_IP

OSS_HOST_TYPE_IP = "ip"

OSS_HOST_TYPE_SPECIAL

OSS_HOST_TYPE_SPECIAL = 'special'

OSS_HOST_TYPE_CNAME

OSS_HOST_TYPE_CNAME = "cname"

OSS_NAME

OSS_NAME = "aliyun-sdk-php"

OSS_VERSION

OSS_VERSION = "2.4.3"

OSS_BUILD

OSS_BUILD = "20210825"

OSS_AUTHOR

OSS_AUTHOR = ""

OSS_OPTIONS_ORIGIN

OSS_OPTIONS_ORIGIN = 'Origin'

OSS_OPTIONS_REQUEST_METHOD

OSS_OPTIONS_REQUEST_METHOD = 'Access-Control-Request-Method'

OSS_OPTIONS_REQUEST_HEADERS

OSS_OPTIONS_REQUEST_HEADERS = 'Access-Control-Request-Headers'

Properties

$OSS_ACL_TYPES

$OSS_ACL_TYPES

$useSSL

$useSSL

$maxRetries

$maxRetries

$redirects

$redirects

$hostType

$hostType

$requestProxy

$requestProxy

$accessKeyId

$accessKeyId

$accessKeySecret

$accessKeySecret

$hostname

$hostname

$securityToken

$securityToken

$enableStsInUrl

$enableStsInUrl

$timeout

$timeout

$connectTimeout

$connectTimeout

Methods

__construct()

__construct(string  $accessKeyId, string  $accessKeySecret, string  $endpoint, bool  $isCName = false, string  $securityToken = NULL, string  $requestProxy = NULL) : mixed

Constructor

There're a few different ways to create an OssClient object:

  1. Most common one from access Id, access Key and the endpoint: $ossClient = new OssClient($id, $key, $endpoint)
  2. If the endpoint is the CName (such as www.testoss.com, make sure it's CName binded in the OSS console), uses $ossClient = new OssClient($id, $key, $endpoint, true)
  3. If using Alicloud's security token service (STS), then the AccessKeyId, AccessKeySecret and STS token are all got from STS. Use this: $ossClient = new OssClient($id, $key, $endpoint, false, $token)
  4. If the endpoint is in IP format, you could use this: $ossClient = new OssClient($id, $key, “1.2.3.4:8900”)

Parameters

string $accessKeyId

The AccessKeyId from OSS or STS

string $accessKeySecret

The AccessKeySecret from OSS or STS

string $endpoint

The domain name of the datacenter,For example: oss-cn-hangzhou.aliyuncs.com

bool $isCName

If this is the CName and binded in the bucket.

string $securityToken

from STS.

string $requestProxy

Throws

\OSS\Core\OssException

Returns

mixed —

listBuckets()

listBuckets(array  $options = NULL) : \OSS\Model\BucketListInfo

Lists the Bucket [GetService]. Not applicable if the endpoint is CName (because CName must be binded to a specific bucket).

Parameters

array $options

Throws

\OSS\Core\OssException

Returns

\OSS\Model\BucketListInfo —

createBucket()

createBucket(string  $bucket, string  $acl = self::OSS_ACL_TYPE_PRIVATE, array  $options = NULL) : null

Creates bucket,The ACL of the bucket created by default is OssClient::OSS_ACL_TYPE_PRIVATE

Parameters

string $bucket
string $acl
array $options

Returns

null —

deleteBucket()

deleteBucket(string  $bucket, array  $options = NULL) : null

Deletes bucket The deletion will not succeed if the bucket is not empty (either has objects or parts) To delete a bucket, all its objects and parts must be deleted first.

Parameters

string $bucket
array $options

Returns

null —

doesBucketExist()

doesBucketExist(string  $bucket) : bool

Checks if a bucket exists

Parameters

string $bucket

Throws

\OSS\Core\OssException

Returns

bool —

getBucketLocation()

getBucketLocation(string  $bucket, array  $options = NULL) : string

Get the data center location information for the bucket

Parameters

string $bucket
array $options

Throws

\OSS\Core\OssException

Returns

string —

getBucketMeta()

getBucketMeta(string  $bucket, array  $options = NULL) : array

Get the Meta information for the Bucket

Parameters

string $bucket
array $options

Refer to the SDK documentation

Returns

array —

getBucketAcl()

getBucketAcl(string  $bucket, array  $options = NULL) : string

Gets the bucket ACL

Parameters

string $bucket
array $options

Throws

\OSS\Core\OssException

Returns

string —

putBucketAcl()

putBucketAcl(string  $bucket, string  $acl, array  $options = NULL) : null

Sets the bucket ACL

Parameters

string $bucket

bucket name

string $acl

access permissions, valid values are ['private', 'public-read', 'public-read-write']

array $options

by default is empty

Throws

\OSS\Core\OssException

Returns

null —

getObjectAcl()

getObjectAcl(string  $bucket, string  $object, array  $options = NULL) : string

Gets object ACL

Parameters

string $bucket
string $object
array $options

Throws

\OSS\Core\OssException

Returns

string —

putObjectAcl()

putObjectAcl(string  $bucket, string  $object, string  $acl, array  $options = NULL) : null

Sets the object ACL

Parameters

string $bucket

bucket name

string $object

object name

string $acl

access permissions, valid values are ['default', 'private', 'public-read', 'public-read-write']

array $options

Throws

\OSS\Core\OssException

Returns

null —

getBucketLogging()

getBucketLogging(string  $bucket, array  $options = NULL) : \OSS\Model\LoggingConfig

Gets the bucket logging config

Parameters

string $bucket

bucket name

array $options

by default is empty

Throws

\OSS\Core\OssException

Returns

\OSS\Model\LoggingConfig —

putBucketLogging()

putBucketLogging(string  $bucket, string  $targetBucket, string  $targetPrefix, array  $options = NULL) : null

Sets the bycket logging config. Only owner can call this API.

Parameters

string $bucket

bucket name

string $targetBucket

The logging file's bucket

string $targetPrefix

The logging file's prefix

array $options

By default is empty.

Throws

\OSS\Core\OssException

Returns

null —

deleteBucketLogging()

deleteBucketLogging(string  $bucket, array  $options = NULL) : null

Deletes the bucket logging config

Parameters

string $bucket

bucket name

array $options

Throws

\OSS\Core\OssException

Returns

null —

putBucketWebsite()

putBucketWebsite(string  $bucket, \OSS\Model\WebsiteConfig  $websiteConfig, array  $options = NULL) : null

Sets the website config in bucket---that is could make the bucket as a static website once the CName is binded.

Parameters

string $bucket

bucket name

\OSS\Model\WebsiteConfig $websiteConfig
array $options

Throws

\OSS\Core\OssException

Returns

null —

getBucketWebsite()

getBucketWebsite(string  $bucket, array  $options = NULL) : \OSS\Model\WebsiteConfig

Gets the website config in the bucket

Parameters

string $bucket

bucket name

array $options

Throws

\OSS\Core\OssException

Returns

\OSS\Model\WebsiteConfig —

deleteBucketWebsite()

deleteBucketWebsite(string  $bucket, array  $options = NULL) : null

Deletes the website config in the bucket

Parameters

string $bucket

bucket name

array $options

Throws

\OSS\Core\OssException

Returns

null —

putBucketCors()

putBucketCors(string  $bucket, \OSS\Model\CorsConfig  $corsConfig, array  $options = NULL) : null

Sets the cross-origin-resource-sharing (CORS) rule. It would overwrite the originl one.

Parameters

string $bucket

bucket name

\OSS\Model\CorsConfig $corsConfig

CORS config. Check out the details from OSS API document

array $options

array

Throws

\OSS\Core\OssException

Returns

null —

getBucketCors()

getBucketCors(string  $bucket, array  $options = NULL) : \OSS\Model\CorsConfig

Gets the bucket CORS config

Parameters

string $bucket

bucket name

array $options

Throws

\OSS\Core\OssException

Returns

\OSS\Model\CorsConfig —

deleteBucketCors()

deleteBucketCors(string  $bucket, array  $options = NULL) : null

Deletes the bucket's CORS config and disable the CORS on the bucket.

Parameters

string $bucket

bucket name

array $options

Throws

\OSS\Core\OssException

Returns

null —

addBucketCname()

addBucketCname(string  $bucket, string  $cname, array  $options = NULL) : null

Bind a CName for the bucket

Parameters

string $bucket

bucket name

string $cname
array $options

Throws

\OSS\Core\OssException

Returns

null —

getBucketCname()

getBucketCname(string  $bucket, array  $options = NULL) : \OSS\Model\CnameConfig

Gets the binded CName list of the bucket

Parameters

string $bucket

bucket name

array $options

Throws

\OSS\Core\OssException

Returns

\OSS\Model\CnameConfig —

deleteBucketCname()

deleteBucketCname(string  $bucket, mixed  $cname, array  $options = NULL) : null

Remove a CName binding from the bucket

Parameters

string $bucket

bucket name

mixed $cname
array $options

Throws

\OSS\Core\OssException

Returns

null —

putBucketLiveChannel()

putBucketLiveChannel(string  $bucket, mixed  $channelName, \OSS\Model\LiveChannelConfig  $channelConfig, array  $options = NULL) : \OSS\Model\LiveChannelInfo

Creates a Live Channel under a bucket

Parameters

string $bucket

bucket name

mixed $channelName
\OSS\Model\LiveChannelConfig $channelConfig
array $options

Throws

\OSS\Core\OssException

Returns

\OSS\Model\LiveChannelInfo —

putLiveChannelStatus()

putLiveChannelStatus(string  $bucket, mixed  $channelName, mixed  $channelStatus, array  $options = NULL) : null

Sets the LiveChannel status

Parameters

string $bucket

bucket name

mixed $channelName
mixed $channelStatus
array $options

Throws

\OSS\Core\OssException

Returns

null —

getLiveChannelInfo()

getLiveChannelInfo(string  $bucket, mixed  $channelName, array  $options = NULL) : \OSS\GetLiveChannelInfo

Gets the LiveChannel information by the channel name

Parameters

string $bucket

bucket name

mixed $channelName
array $options

Throws

\OSS\Core\OssException

Returns

\OSS\GetLiveChannelInfo —

getLiveChannelStatus()

getLiveChannelStatus(string  $bucket, mixed  $channelName, array  $options = NULL) : \OSS\GetLiveChannelStatus

Gets the status of LiveChannel

Parameters

string $bucket

bucket name

mixed $channelName
array $options

Throws

\OSS\Core\OssException

Returns

\OSS\GetLiveChannelStatus —

getLiveChannelHistory()

getLiveChannelHistory(string  $bucket, mixed  $channelName, array  $options = NULL) : \OSS\GetLiveChannelHistory

Gets the LiveChannel pushing streaming record

Parameters

string $bucket

bucket name

mixed $channelName
array $options

Throws

\OSS\Core\OssException

Returns

\OSS\GetLiveChannelHistory —

listBucketLiveChannels()

listBucketLiveChannels(string  $bucket, array  $options = NULL) : \OSS\Model\LiveChannelListInfo

Gets the live channel list under a bucket.

Parameters

string $bucket

bucket name

array $options

Throws

\OSS\Core\OssException

Returns

\OSS\Model\LiveChannelListInfo —

postVodPlaylist()

postVodPlaylist(string  $bucket, mixed  $channelName, string  $playlistName, array  $setTime) : null

Creates a play list file for the LiveChannel

Parameters

string $bucket

bucket name

mixed $channelName
string $playlistName

The playlist name, must end with ".m3u8".

array $setTime

startTime and EndTime in unix time. No more than 1 day.

Throws

\OSS\Core\OssException

Returns

null —

deleteBucketLiveChannel()

deleteBucketLiveChannel(string  $bucket, mixed  $channelName, array  $options = NULL) : null

Deletes the Bucket LiveChannel

Parameters

string $bucket

bucket name

mixed $channelName
array $options

Throws

\OSS\Core\OssException

Returns

null —

signRtmpUrl()

signRtmpUrl(string  $bucket, mixed  $channelName, mixed  $timeout = 60, array  $options = NULL) : \OSS\The

Generates the signed pushing streaming url

Parameters

string $bucket

bucket name

mixed $channelName
mixed $timeout
array $options

Throws

\OSS\Core\OssException

Returns

\OSS\The —

signed pushing streaming url

generatePresignedRtmpUrl()

generatePresignedRtmpUrl(string  $bucket, string  $channelName, int  $expiration, array  $options = NULL) : \OSS\The

Generates the signed pushing streaming url

Parameters

string $bucket

bucket name

string $channelName

channel name

int $expiration

expiration time of the Url, unix epoch, since 1970.1.1 00.00.00 UTC

array $options

Throws

\OSS\Core\OssException

Returns

\OSS\The —

signed pushing streaming url

optionsObject()

optionsObject(string  $bucket, string  $object, string  $origin, string  $request_method, string  $request_headers, array  $options = NULL) : array

Precheck the CORS request. Before sending a CORS request, a preflight request (OPTIONS) is sent with the specific origin.

HTTP METHOD and headers information are sent to OSS as well for evaluating if the CORS request is allowed.

Note: OSS could enable the CORS on the bucket by calling putBucketCors. Once CORS is enabled, the OSS could evaluate accordingto the preflight request.

Parameters

string $bucket

bucket name

string $object

object name

string $origin

the origin of the request

string $request_method

The actual HTTP method which will be used in CORS request

string $request_headers

The actual HTTP headers which will be used in CORS request

array $options

Throws

\OSS\Core\OssException

Returns

array —

putBucketLifecycle()

putBucketLifecycle(string  $bucket, \OSS\Model\LifecycleConfig  $lifecycleConfig, array  $options = NULL) : null

Sets the bucket's lifecycle config

Parameters

string $bucket

bucket name

\OSS\Model\LifecycleConfig $lifecycleConfig

LifecycleConfig instance

array $options

Throws

\OSS\Core\OssException

Returns

null —

getBucketLifecycle()

getBucketLifecycle(string  $bucket, array  $options = NULL) : \OSS\Model\LifecycleConfig

Gets bucket's lifecycle config

Parameters

string $bucket

bucket name

array $options

Throws

\OSS\Core\OssException

Returns

\OSS\Model\LifecycleConfig —

deleteBucketLifecycle()

deleteBucketLifecycle(string  $bucket, array  $options = NULL) : null

Deletes the bucket's lifecycle config

Parameters

string $bucket

bucket name

array $options

Throws

\OSS\Core\OssException

Returns

null —

putBucketReferer()

putBucketReferer(string  $bucket, \OSS\Model\RefererConfig  $refererConfig, array  $options = NULL) : \OSS\Http\ResponseCore

Sets a bucket's referer, which has a whitelist of referrer and specifies if empty referer is allowed.

Checks out API document for more details about "Bucket Referer"

Parameters

string $bucket

bucket name

\OSS\Model\RefererConfig $refererConfig
array $options

Throws

null

Returns

\OSS\Http\ResponseCore —

getBucketReferer()

getBucketReferer(string  $bucket, array  $options = NULL) : \OSS\Model\RefererConfig

Gets the bucket's Referer Checks out API document for more details about "Bucket Referer"

Parameters

string $bucket

bucket name

array $options

Throws

\OSS\Core\OssException

Returns

\OSS\Model\RefererConfig —

putBucketStorageCapacity()

putBucketStorageCapacity(string  $bucket, int  $storageCapacity, array  $options = NULL) : \OSS\Http\ResponseCore

Set the size of the bucket,the unit is GB When the capacity of the bucket is bigger than the set, it's forbidden to continue writing

Parameters

string $bucket

bucket name

int $storageCapacity
array $options

Throws

null

Returns

\OSS\Http\ResponseCore —

getBucketStorageCapacity()

getBucketStorageCapacity(string  $bucket, array  $options = NULL) : int

Get the capacity of the bucket, the unit is GB

Parameters

string $bucket

bucket name

array $options

Throws

\OSS\Core\OssException

Returns

int —

getBucketInfo()

getBucketInfo(string  $bucket, array  $options = NULL) : \OSS\BucketInfo

Get the information of the bucket

Parameters

string $bucket

bucket name

array $options

Throws

\OSS\Core\OssException

Returns

\OSS\BucketInfo —

getBucketStat()

getBucketStat(string  $bucket, array  $options = NULL) : \OSS\Model\BucketStat

Get the stat of the bucket

Parameters

string $bucket

bucket name

array $options

Throws

\OSS\Core\OssException

Returns

\OSS\Model\BucketStat —

putBucketPolicy()

putBucketPolicy(string  $bucket, string  $policy, array  $options = NULL) : null

Sets the bucket's policy

Parameters

string $bucket

bucket name

string $policy

policy json format content

array $options

Throws

\OSS\Core\OssException

Returns

null —

getBucketPolicy()

getBucketPolicy(string  $bucket, array  $options = NULL) : string

Gets bucket's policy

Parameters

string $bucket

bucket name

array $options

Throws

\OSS\Core\OssException

Returns

string —

policy json content

deleteBucketPolicy()

deleteBucketPolicy(string  $bucket, array  $options = NULL) : null

Deletes the bucket's policy

Parameters

string $bucket

bucket name

array $options

Throws

\OSS\Core\OssException

Returns

null —

putBucketEncryption()

putBucketEncryption(string  $bucket, \OSS\Model\ServerSideEncryptionConfig  $sseConfig, array  $options = NULL) : null

Sets the bucket's encryption

Parameters

string $bucket

bucket name

\OSS\Model\ServerSideEncryptionConfig $sseConfig
array $options

Throws

\OSS\Core\OssException

Returns

null —

getBucketEncryption()

getBucketEncryption(string  $bucket, array  $options = NULL) : \OSS\Model\ServerSideEncryptionConfig

Gets bucket's encryption

Parameters

string $bucket

bucket name

array $options

Throws

\OSS\Core\OssException

Returns

\OSS\Model\ServerSideEncryptionConfig —

deleteBucketEncryption()

deleteBucketEncryption(string  $bucket, array  $options = NULL) : null

Deletes the bucket's encryption

Parameters

string $bucket

bucket name

array $options

Throws

\OSS\Core\OssException

Returns

null —

putBucketRequestPayment()

putBucketRequestPayment(string  $bucket, string  $payer, array  $options = NULL) : \OSS\Http\ResponseCore

Set the request playment of the bucket, Can be BucketOwner and Requester

Parameters

string $bucket

bucket name

string $payer
array $options

Throws

null

Returns

\OSS\Http\ResponseCore —

getBucketRequestPayment()

getBucketRequestPayment(string  $bucket, array  $options = NULL) : string

Get the request playment of the bucket

Parameters

string $bucket

bucket name

array $options

Throws

\OSS\Core\OssException

Returns

string —

putBucketTags()

putBucketTags(string  $bucket, \OSS\Model\TaggingConfig  $taggingConfig, array  $options = NULL) : null

Sets the bucket's tags

Parameters

string $bucket

bucket name

\OSS\Model\TaggingConfig $taggingConfig
array $options

Throws

\OSS\Core\OssException

Returns

null —

getBucketTags()

getBucketTags(string  $bucket, array  $options = NULL) : \OSS\Model\TaggingConfig

Gets bucket's tags

Parameters

string $bucket

bucket name

array $options

Throws

\OSS\Core\OssException

Returns

\OSS\Model\TaggingConfig —

deleteBucketTags()

deleteBucketTags(string  $bucket, \OSS\tag[]  $tags = NULL, array  $options = NULL) : null

Deletes the bucket's tags If want to delete specified tags for a bucket, please set the $tags

Parameters

string $bucket

bucket name

\OSS\tag[] $tags

(optional)

array $options

Throws

\OSS\Core\OssException

Returns

null —

putBucketVersioning()

putBucketVersioning(string  $bucket, string  $status, array  $options = NULL) : \OSS\Http\ResponseCore

Set the versioning of the bucket, Can be BucketOwner and Requester

Parameters

string $bucket

bucket name

string $status
array $options

Throws

null

Returns

\OSS\Http\ResponseCore —

getBucketVersioning()

getBucketVersioning(string  $bucket, array  $options = NULL) : string

Get the versioning of the bucket

Parameters

string $bucket

bucket name

array $options

Throws

\OSS\Core\OssException

Returns

string —

initiateBucketWorm()

initiateBucketWorm(string  $bucket, int  $day, array  $options = NULL) : string

Initialize a bucket's worm

Parameters

string $bucket

bucket name

int $day
array $options

Throws

\OSS\Core\OssException

Returns

string —

returns uploadid

abortBucketWorm()

abortBucketWorm(string  $bucket, array  $options = NULL) : null

Aborts the bucket's worm

Parameters

string $bucket

bucket name

array $options

Throws

\OSS\Core\OssException

Returns

null —

completeBucketWorm()

completeBucketWorm(string  $bucket, string  $wormId, array  $options = NULL) : string

Complete a bucket's worm

Parameters

string $bucket

bucket name

string $wormId
array $options

Throws

\OSS\Core\OssException

Returns

string —

returns uploadid

extendBucketWorm()

extendBucketWorm(string  $bucket, string  $wormId, int  $day, array  $options = NULL) : string

Extend a bucket's worm

Parameters

string $bucket

bucket name

string $wormId
int $day
array $options

Throws

\OSS\Core\OssException

Returns

string —

returns uploadid

getBucketWorm()

getBucketWorm(string  $bucket, array  $options = NULL) : string

Get a bucket's worm

Parameters

string $bucket

bucket name

array $options

Throws

\OSS\Core\OssException

Returns

string —

listObjects()

listObjects(string  $bucket, array  $options = NULL) : \OSS\Model\ObjectListInfo

Lists the bucket's object list (in ObjectListInfo)

Parameters

string $bucket
array $options

are defined below: $options = array( 'max-keys' => specifies max object count to return. By default is 100 and max value could be 1000. 'prefix' => specifies the key prefix the returned objects must have. Note that the returned keys still contain the prefix. 'delimiter' => The delimiter of object name for grouping object. When it's specified, listObjects will differeniate the object and folder. And it will return subfolder's objects. 'marker' => The key of returned object must be greater than the 'marker'. ) Prefix and marker are for filtering and paging. Their length must be less than 256 bytes

Throws

\OSS\Core\OssException

Returns

\OSS\Model\ObjectListInfo —

listObjectVersions()

listObjectVersions(string  $bucket, array  $options = NULL) : \OSS\Model\ObjectListInfo

Lists the bucket's object with version information (in ObjectListInfo)

Parameters

string $bucket
array $options

are defined below: $options = array( 'max-keys' => specifies max object count to return. By default is 100 and max value could be 1000. 'prefix' => specifies the key prefix the returned objects must have. Note that the returned keys still contain the prefix. 'delimiter' => The delimiter of object name for grouping object. When it's specified, listObjectVersions will differeniate the object and folder. And it will return subfolder's objects. 'key-marker' => The key of returned object must be greater than the 'key-marker'. 'version-id-marker' => The version id of returned object must be greater than the 'version-id-marker'. ) Prefix and marker are for filtering and paging. Their length must be less than 256 bytes

Throws

\OSS\Core\OssException

Returns

\OSS\Model\ObjectListInfo —

createObjectDir()

createObjectDir(string  $bucket, string  $object, array  $options = NULL) : null

Creates a virtual 'folder' in OSS. The name should not end with '/' because the method will append the name with a '/' anyway.

Internal use only.

Parameters

string $bucket

bucket name

string $object

object name

array $options

Returns

null —

putObject()

putObject(string  $bucket, string  $object, string  $content, array  $options = NULL) : null

Uploads the $content object to OSS.

Parameters

string $bucket

bucket name

string $object

objcet name

string $content

The content object

array $options

Returns

null —

putSymlink()

putSymlink(string  $bucket, string  $symlink, string  $targetObject, array  $options = NULL) : null

creates symlink

Parameters

string $bucket

bucket name

string $symlink

symlink name

string $targetObject

targetObject name

array $options

Returns

null —

getSymlink()

getSymlink(string  $bucket, string  $symlink, array  $options = NULL) : null

gets symlink

Parameters

string $bucket

bucket name

string $symlink

symlink name

array $options

Returns

null —

uploadFile()

uploadFile(string  $bucket, string  $object, string  $file, array  $options = NULL) : null

Uploads a local file

Parameters

string $bucket

bucket name

string $object

object name

string $file

local file path

array $options

Throws

\OSS\Core\OssException

Returns

null —

uploadStream()

uploadStream(string  $bucket, string  $object, resource  $handle, array  $options = NULL) : null

Uploads object from file handle

Parameters

string $bucket

bucket name

string $object

object name

resource $handle

file handle

array $options

Throws

\OSS\Core\OssException

Returns

null —

appendObject()

appendObject(string  $bucket, string  $object, string  $content, mixed  $position, array  $options = NULL) : int

Append the object with the content at the specified position.

The specified position is typically the lengh of the current file.

Parameters

string $bucket

bucket name

string $object

objcet name

string $content

content to append

mixed $position
array $options

Throws

\OSS\Core\OssException

Returns

int —

next append position

appendFile()

appendFile(string  $bucket, string  $object, string  $file, mixed  $position, array  $options = NULL) : int

Append the object with a local file

Parameters

string $bucket

bucket name

string $object

object name

string $file

The local file path to append with

mixed $position
array $options

Throws

\OSS\Core\OssException

Returns

int —

next append position

copyObject()

copyObject(string  $fromBucket, string  $fromObject, string  $toBucket, string  $toObject, array  $options = NULL) : null

Copy from an existing OSS object to another OSS object. If the target object exists already, it will be overwritten.

Parameters

string $fromBucket

Source bucket name

string $fromObject

Source object name

string $toBucket

Target bucket name

string $toObject

Target object name

array $options

Throws

\OSS\Core\OssException

Returns

null —

getObjectMeta()

getObjectMeta(string  $bucket, string  $object, string  $options = NULL) : array

Gets Object metadata

Parameters

string $bucket

bucket name

string $object

object name

string $options

Checks out the SDK document for the detail

Returns

array —

getSimplifiedObjectMeta()

getSimplifiedObjectMeta(string  $bucket, string  $object, string  $options = NULL) : array

Gets the simplified metadata of a object.

Simplified metadata includes ETag, Size, LastModified.

Parameters

string $bucket

bucket name

string $object

object name

string $options

Checks out the SDK document for the detail

Returns

array —

deleteObject()

deleteObject(string  $bucket, string  $object, array  $options = NULL) : null

Deletes a object

Parameters

string $bucket

bucket name

string $object

object name

array $options

Returns

null —

deleteObjects()

deleteObjects(string  $bucket, array  $objects, array  $options = null) : \OSS\Http\ResponseCore

Deletes multiple objects in a bucket

Parameters

string $bucket

bucket name

array $objects

object list

array $options

Throws

null

Returns

\OSS\Http\ResponseCore —

deleteObjectVersions()

deleteObjectVersions(string  $bucket, array  $objects, array  $options = null) : \OSS\Http\ResponseCore

Deletes multiple objects with version id in a bucket

Parameters

string $bucket

bucket name

array $objects

DeleteObjectInfo list

array $options

Throws

null

Returns

\OSS\Http\ResponseCore —

getObject()

getObject(string  $bucket, string  $object, array  $options = NULL) : string

Gets Object content

Parameters

string $bucket

bucket name

string $object

object name

array $options

It must contain ALIOSS::OSS_FILE_DOWNLOAD. And ALIOSS::OSS_RANGE is optional and empty means to download the whole file.

Returns

string —

doesObjectExist()

doesObjectExist(string  $bucket, string  $object, array  $options = NULL) : bool

Checks if the object exists It's implemented by getObjectMeta().

Parameters

string $bucket

bucket name

string $object

object name

array $options

Returns

bool —

True:object exists; False:object does not exist

restoreObject()

restoreObject(string  $bucket, string  $object, mixed  $options = NULL) : null

Object reading for Archive type Use Restore to enable the server to perform the thawing task

Parameters

string $bucket

bucket name

string $object

object name

mixed $options

Throws

\OSS\Core\OssException

Returns

null —

putObjectTagging()

putObjectTagging(string  $bucket, string  $object, \OSS\Model\TaggingConfig  $taggingConfig, mixed  $options = NULL) : null

Sets the object tagging

Parameters

string $bucket

bucket name

string $object

object name

\OSS\Model\TaggingConfig $taggingConfig
mixed $options

Throws

\OSS\Core\OssException

Returns

null —

getObjectTagging()

getObjectTagging(string  $bucket, string  $object, mixed  $options = NULL) : \OSS\Model\TaggingConfig

Gets the object tagging

Parameters

string $bucket
string $object
mixed $options

Throws

\OSS\Core\OssException

Returns

\OSS\Model\TaggingConfig —

deleteObjectTagging()

deleteObjectTagging(string  $bucket, string  $object, mixed  $options = NULL) : \OSS\Model\TaggingConfig

Deletes the object tagging

Parameters

string $bucket
string $object
mixed $options

Throws

\OSS\Core\OssException

Returns

\OSS\Model\TaggingConfig —

processObject()

processObject(string  $bucket, string  $object, string  $process, mixed  $options = NULL) : string

Processes the object

Parameters

string $bucket

bucket name

string $object

object name

string $process

process script

mixed $options

Returns

string —

process result, json format

generateMultiuploadParts()

generateMultiuploadParts(int  $file_size, int  $partSize = 5242880) : array

Computes the parts count, size and start position according to the file size and the part size.

It must be only called by upload_Part().

Parameters

int $file_size

File size

int $partSize

part大小,part size. Default is 5MB

Returns

array —

An array contains key-value pairs--the key is seekToand value is length.

initiateMultipartUpload()

initiateMultipartUpload(string  $bucket, string  $object, array  $options = NULL) : string

Initialize a multi-part upload

Parameters

string $bucket

bucket name

string $object

object name

array $options

Key-Value array

Throws

\OSS\Core\OssException

Returns

string —

returns uploadid

uploadPart()

uploadPart(string  $bucket, string  $object, string  $uploadId, array  $options = null) : string

Upload a part in a multiparts upload.

Parameters

string $bucket

bucket name

string $object

object name

string $uploadId
array $options

Key-Value array

Throws

\OSS\Core\OssException

Returns

string —

eTag

listParts()

listParts(string  $bucket, string  $object, string  $uploadId, array  $options = null) : \OSS\Model\ListPartsInfo

Gets the uploaded parts.

Parameters

string $bucket

bucket name

string $object

object name

string $uploadId

uploadId

array $options

Key-Value array

Throws

\OSS\Core\OssException

Returns

\OSS\Model\ListPartsInfo —

abortMultipartUpload()

abortMultipartUpload(string  $bucket, string  $object, string  $uploadId, array  $options = NULL) : null

Abort a multiparts upload

Parameters

string $bucket

bucket name

string $object

object name

string $uploadId

uploadId

array $options

Key-Value name

Throws

\OSS\Core\OssException

Returns

null —

completeMultipartUpload()

completeMultipartUpload(string  $bucket, string  $object, string  $uploadId, array  $listParts, array  $options = NULL) : null

Completes a multiparts upload, after all parts are uploaded.

Parameters

string $bucket

bucket name

string $object

object name

string $uploadId

uploadId

array $listParts

array( array("PartNumber"=> int, "ETag"=>string))

array $options

Key-Value array

Throws

\OSS\Core\OssException

Returns

null —

listMultipartUploads()

listMultipartUploads(string  $bucket, array  $options = null) : \OSS\Model\ListMultipartUploadInfo

Lists all ongoing multipart upload events, which means all initialized but not completed or aborted multipart uploads.

Parameters

string $bucket

bucket

array $options

key-value array--expected keys are 'delimiter', 'key-marker', 'max-uploads', 'prefix', 'upload-id-marker'

Throws

\OSS\Core\OssException

Returns

\OSS\Model\ListMultipartUploadInfo —

uploadPartCopy()

uploadPartCopy(string  $fromBucket, string  $fromObject, string  $toBucket, string  $toObject, int  $partNumber, string  $uploadId, array  $options = NULL) : null

Copy an existing file as a part

Parameters

string $fromBucket

source bucket name

string $fromObject

source object name

string $toBucket

target bucket name

string $toObject

target object name

int $partNumber

Part number

string $uploadId

Upload Id

array $options

Key-Value array---it should have 'start' or 'end' key to specify the range of the source object to copy. If it's not specifed, the whole object is copied.

Throws

\OSS\Core\OssException

Returns

null —

multiuploadFile()

multiuploadFile(string  $bucket, string  $object, string  $file, array  $options = null) : null

A higher level API for uploading a file with multipart upload. It consists of initialization, parts upload and completion.

Parameters

string $bucket

bucket name

string $object

object name

string $file

The local file to upload

array $options

Key-Value array

Throws

\OSS\Core\OssException

Returns

null —

uploadDir()

uploadDir(string  $bucket, string  $prefix, string  $localDirectory, string  $exclude = '.|..|.svn|.git', bool  $recursive = false, bool  $checkMd5 = true) : array

Uploads the local directory to the specified bucket into specified folder (prefix)

Parameters

string $bucket

bucket name

string $prefix

The object key prefix. Typically it's folder name. The name should not end with '/' as the API appends it automatically.

string $localDirectory

The local directory to upload

string $exclude

To excluded directories

bool $recursive

Recursive flag. True: Recursively upload all datas under the local directory; False: only upload first layer's files.

bool $checkMd5

Throws

\OSS\Core\OssException

Returns

array —

Returns two list: array("succeededList" => array("object"), "failedList" => array("object"=>"errorMessage"))

signUrl()

signUrl(string  $bucket, string  $object, int  $timeout = 60, string  $method = self::OSS_HTTP_GET, array  $options = NULL) : string

Sign URL with specified expiration time in seconds (timeout) and HTTP method.

The signed URL could be used to access the object directly.

Parameters

string $bucket
string $object
int $timeout

expiration time in seconds.

string $method
array $options

Key-Value array

Throws

\OSS\Core\OssException

Returns

string —

generatePresignedUrl()

generatePresignedUrl(string  $bucket, string  $object, int  $expiration, string  $method = self::OSS_HTTP_GET, array  $options = NULL) : string

Sign URL with specified expiration time in seconds and HTTP method.

The signed URL could be used to access the object directly.

Parameters

string $bucket
string $object
int $expiration

expiration time of the Url, unix epoch, since 1970.1.1 00.00.00 UTC

string $method
array $options

Key-Value array

Throws

\OSS\Core\OssException

Returns

string —

setMaxTries()

setMaxTries(int  $maxRetries = 3) : void

Sets the max retry count

Parameters

int $maxRetries

getMaxRetries()

getMaxRetries() : int

Gets the max retry count

Returns

int —

setSignStsInUrl()

setSignStsInUrl(bool  $enable) : mixed

Enaable/disable STS in the URL. This is to determine the $sts value passed from constructor take effect or not.

Parameters

bool $enable

Returns

mixed —

isUseSSL()

isUseSSL() : bool

Returns

bool —

setUseSSL()

setUseSSL(bool  $useSSL) : mixed

Parameters

bool $useSSL

Returns

mixed —

checkEnv()

checkEnv() : mixed

Check if all dependent extensions are installed correctly.

For now only "curl" is needed.

Throws

\OSS\Core\OssException

Returns

mixed —

setTimeout()

setTimeout(int  $timeout) : mixed

Sets the http's timeout (in seconds)

Parameters

int $timeout

Returns

mixed —

setConnectTimeout()

setConnectTimeout(int  $connectTimeout) : mixed

Sets the http's connection timeout (in seconds)

Parameters

int $connectTimeout

Returns

mixed —

computePartSize()

computePartSize(int  $partSize) : int

Gets the part size according to the preferred part size.

If the specified part size is too small or too big, it will return a min part or max part size instead. Otherwise returns the specified part size.

Parameters

int $partSize

Returns

int —

precheckOptions()

precheckOptions(array  $options) : mixed

validates options. Create a empty array if it's NULL.

Parameters

array $options

Throws

\OSS\Core\OssException

Returns

mixed —

precheckBucket()

precheckBucket(string  $bucket, string  $errMsg = 'bucket is not allowed empty') : mixed

Validates bucket parameter

Parameters

string $bucket
string $errMsg

Throws

\OSS\Core\OssException

Returns

mixed —

precheckObject()

precheckObject(string  $object) : mixed

validates object parameter

Parameters

string $object

Throws

\OSS\Core\OssException

Returns

mixed —

precheckStorage()

precheckStorage(mixed  $storage) : mixed

校验option restore

Parameters

mixed $storage

Throws

\OSS\Core\OssException

Returns

mixed —

precheckCommon()

precheckCommon(string  $bucket, string  $object, array  $options, bool  $isCheckObject = true) : mixed

Validates bucket,options parameters and optionally validate object parameter.

Parameters

string $bucket
string $object
array $options
bool $isCheckObject

Returns

mixed —

precheckParam()

precheckParam(array  $options, string  $param, string  $funcName) : mixed

checks parameters

Parameters

array $options
string $param
string $funcName

Throws

\OSS\Core\OssException

Returns

mixed —

isCheckMD5()

isCheckMD5(array  $options) : bool|null

Checks md5

Parameters

array $options

Returns

bool|null —

getValue()

getValue(array  $options, string  $key, string  $default = NULL, bool  $isCheckEmpty = false, bool  $isCheckBool = false) : bool|null

Gets value of the specified key from the options

Parameters

array $options
string $key
string $default
bool $isCheckEmpty
bool $isCheckBool

Returns

bool|null —

getMimeType()

getMimeType(string  $object, mixed  $file = null) : string

Gets mimetype

Parameters

string $object
mixed $file

Returns

string —

auth()

auth(array  $options) : \OSS\Http\ResponseCore

Validates and executes the request according to OSS API protocol.

Parameters

array $options

Throws

\OSS\Core\OssException
\OSS\Http\RequestCore_Exception

Returns

\OSS\Http\ResponseCore —

authPrecheckBucket()

authPrecheckBucket( $options) : mixed

Validates bucket name--throw OssException if it's invalid

Parameters

$options

Throws

\OSS\Core\OssException

Returns

mixed —

authPrecheckObject()

authPrecheckObject( $options) : mixed

Validates the object name--throw OssException if it's invalid.

Parameters

$options

Throws

\OSS\Core\OssException

Returns

mixed —

authPrecheckObjectEncoding()

authPrecheckObjectEncoding(mixed  $options) : mixed

Checks the object's encoding. Convert it to UTF8 if it's in GBK or GB2312

Parameters

mixed $options

parameter

Returns

mixed —

authPrecheckAcl()

authPrecheckAcl( $options) : mixed

Checks if the ACL is one of the 3 predefined one. Throw OSSException if not.

Parameters

$options

Throws

\OSS\Core\OssException

Returns

mixed —

generateHostname()

generateHostname( $bucket) : string

Gets the host name for the current request.

It could be either a third level domain (prefixed by bucket name) or second level domain if it's CName or IP

Parameters

$bucket

Returns

string —

The host name without the protocol scheem (e.g. https://)

generateResourceUri()

generateResourceUri( $options) : string

Gets the resource Uri in the current request

Parameters

$options

Returns

string —

return the resource uri.

generateSignableQueryStringParam()

generateSignableQueryStringParam(array  $options) : array

Generates the signalbe query string parameters in array type

Parameters

array $options

Returns

array —

generateSignableResource()

generateSignableResource(mixed  $options) : string

Generates the resource uri for signing

Parameters

mixed $options

Returns

string —

generateQueryString()

generateQueryString(mixed  $options) : string

generates query string

Parameters

mixed $options

Returns

string —

stringToSignSorted()

stringToSignSorted(mixed  $string_to_sign) : mixed

Parameters

mixed $string_to_sign

Returns

mixed —

generateHeaders()

generateHeaders(mixed  $options, string  $hostname) : array

Initialize headers

Parameters

mixed $options
string $hostname

hostname

Returns

array —

generateUserAgent()

generateUserAgent() : string

Generates UserAgent

Returns

string —

checkEndpoint()

checkEndpoint(string  $endpoint, bool  $isCName) : string

Checks endpoint type and returns the endpoint without the protocol schema.

Figures out the domain's type (ip, cname or private/public domain).

Parameters

string $endpoint
bool $isCName

Returns

string —

The domain name without the protocol schema.