ParseClient

Class ParseClient - Main class for Parse initialization and communication.

author

Fosco Marotto fjm@fb.com

package

Parse

Methods

Clears the existing mount path.

_clearMountPath() 
static

Used primarily for testing purposes.

Clears the existing server url.

_clearServerURL() 
static

Used primarily for testing purposes.

ParseClient::_decode, internal method for decoding server responses.

_decode(mixed $data) : mixed
static

Arguments

$data

mixed

The value to decode

Response

mixed

ParseClient::_encode, internal method for encoding object values.

_encode(mixed $value, boolean $allowParseObjects) : mixed
static
Throws
\Exception

Arguments

$value

mixed

Value to encode

$allowParseObjects

boolean

Allow nested objects

Response

mixed

Encoded results.

ParseClient::_encodeArray, internal method for encoding arrays.

_encodeArray(array $value, boolean $allowParseObjects) : array
static

Arguments

$value

array

Array to encode.

$allowParseObjects

boolean

Allow nested objects.

Response

array

Encoded results.

Parse\Client::_request, internal method for communicating with Parse.

_request(string $method, string $relativeUrl, null $sessionToken = null, null $data = null, boolean $useMasterKey = false, boolean $appRequest = false, string $contentType = 'application/json', boolean $returnHeaders = false) : mixed
static
Throws
\Exception

Arguments

$method

string

HTTP Method for this request.

$relativeUrl

string

REST API Path.

$sessionToken

null

Session Token.

$data

null

Data to provide with the request.

$useMasterKey

boolean

Whether to use the Master Key.

$appRequest

boolean

App request to create or modify a application

$contentType

string

The content type for this request, default is application/json

$returnHeaders

boolean

Allow to return response headers

Response

mixed

Result from Parse API Call.

ParseClient::_unsetStorage, will null the storage object.

_unsetStorage() 
static

Without some ability to clear the storage objects, all test cases would use the first assigned storage object.

Asserts that the sdk has been initialized with a valid account key

assertAppInitialized() 
static
Throws
\Exception

Asserts that the sdk has been initialized with a valid application id

assertParseInitialized() 
static
Throws
\Exception

Asserts that the server and mount path have been initialized

assertServerInitialized() 
static
Throws
\Exception

Clears the currently set http client

clearHttpClient() 
static

Allows an existing application to start using revocable sessions, without forcing all requests for the app to use them. After calling this method, login & signup requests will be returned a unique and revocable session token.

enableRevocableSessions() 
static

Get remote Parse API url.

getAPIUrl() : string
static

Response

string

Gets the current Http client, or creates one to suite the need

getHttpClient() : \Parse\HttpClients\ParseHttpable
static

Returns the last error message from a failed json_decode call

getLastJSONErrorMsg() : string
static

Response

string

Get remote Parse API mount path

getMountPath() : string
static

Response

string

Get a date value in the format stored on Parse.

getProperDateFormat(\DateTime $value) : string
static

All the SDKs do some slightly different date handling. PHP provides 6 digits for the microseconds (u) so we have to chop 3 off.

Arguments

$value

\DateTime

DateTime value to format.

Response

string

Get a date value in the format to use in Local Push Scheduling on Parse.

getPushDateFormat(\DateTime $value, boolean $local = false) : string
static

All the SDKs do some slightly different date handling. Format from Parse doc: an ISO 8601 date without a time zone, i.e. 2014-10-16T12:00:00 .

Arguments

$value

\DateTime

DateTime value to format.

$local

boolean

Whether to return the local push time

Response

string

ParseClient::getStorage, will return the storage object used for persistence.

getStorage() : \Parse\ParseStorageInterface
static

Parse\Client::initialize, must be called before using Parse features.

initialize(string $app_id, string $rest_key, string $master_key, boolean $enableCurlExceptions = true, string $account_key = null) 
static
Throws
\Exception

Arguments

$app_id

string

Parse Application ID

$rest_key

string

Parse REST API Key

$master_key

string

Parse Master Key

$enableCurlExceptions

boolean

Enable or disable Parse curl exceptions

$account_key

string

An account key from Parse.com can enable creating apps via API.

Sets a CA file to validate peers of our requests with

setCAFile(string $caFile) 
static

Arguments

$caFile

string

CA file to set

Sets number of seconds to wait while trying to connect. Use 0 to wait indefinitely, null to default behaviour.

setConnectionTimeout(integer|null $connectionTimeout) 
static

Arguments

$connectionTimeout

integer|null

Sets the Http client to use for requests

setHttpClient(\Parse\HttpClients\ParseHttpable $httpClient) 
static

Arguments

$httpClient

\Parse\HttpClients\ParseHttpable

Http client to use

ParseClient::setServerURL, to change the Parse Server address & mount path for this app

setServerURL(string $serverURL, string $mountPath) 
static
Throws
\Exception

Arguments

$serverURL

string

The remote server url

$mountPath

string

The mount path for this server

ParseClient::setStorage, will update the storage object used for persistence.

setStorage(\Parse\ParseStorageInterface $storageObject) 
static

Arguments

Sets maximum number of seconds of request/response operation.

setTimeout(integer|null $timeout) 
static

Use 0 to wait indefinitely, null to default behaviour.

Arguments

$timeout

integer|null

Constants

Constant for version string to include with requests. Currently 1.3.0.

VERSION_STRING
var

Properties

The remote Parse Server to communicate with

serverURL : string
static
var

Type(s)

string

The mount path for the current parse server

mountPath : string
static
var

Type(s)

string

The application id.

applicationId : string
static
var

Type(s)

string

The REST API Key.

restKey : string|null
static
var

Type(s)

string|null

The Master Key.

masterKey : string
static
var

Type(s)

string

Enable/Disable curl exceptions.

enableCurlExceptions : boolean
static
var

Type(s)

boolean

The account key.

accountKey : string
static
var

Type(s)

string

The object for managing persistence.

storage : \Parse\ParseStorageInterface
static

Are revocable sessions enabled?

forceRevocableSession : boolean
static
var

Type(s)

boolean

Number of seconds to wait while trying to connect. Use 0 to wait indefinitely.

connectionTimeout : integer
static
var

Type(s)

integer

Maximum number of seconds of request/response operation.

timeout : integer
static
var

Type(s)

integer

Http client for requests

httpClient : \Parse\HttpClients\ParseHttpable
static

CA file holding one or more certificates to verify a peer

caFile : string
static
var

Type(s)

string