class Certificate implements Serializable

Constants

ENDPOINT_ENV_PRODUCTION

Identifies the APNS production environment

ENDPOINT_ENV_SANDBOX

Identifies the APNS sandbox/development environment

ENDPOINT_TYPE_GATEWAY

Identifies the APNS sending gateway

ENDPOINT_TYPE_FEEDBACK

Identifies the APNS feedback service

Methods

__construct(string $pemFile, string|null $passphrase = null, boolean $validate = true, string|null $endpointEnv = null)

APNS Certificate constructor

string
getPemFile()

Get the path to the PEM file

boolean
hasPassphrase()

Checks if there is a passphrase to use with the certificate

string
getPassphrase()

Passphrase to use with the PEM file

Certificate::ENDPOINT_ENV_PRODUCTION|Certificate::ENDPOINT_ENV_SANDBOX
getEnvironment()

Get the APNS environment this certificate is associated with

boolean
isValidated()

Check if this certificate is validated

string
getDescription()

An as humanreadable as possible description of the certificate to identify the certificate

DateTime|null
getValidFrom()

Get moment this certificate will become valid Note: Will return null if certificate validation was disabled

DateTime|null
getValidTo()

Get moment this certificate will expire Note: Will return null if certificate validation was disabled

string
getEndpoint(string $endpointType)

Get the endpoint this certificate is valid for

string
getFingerprint()

Get a unique hash of the certificate this can be used to check if two Apns\Certificate objects are the same

string
serialize()

String representation of object

unserialize(string $serialized)

Constructs the object from serialized data

Details

at line 61
__construct(string $pemFile, string|null $passphrase = null, boolean $validate = true, string|null $endpointEnv = null)

APNS Certificate constructor

Parameters

string $pemFile Path to the PEM certificate file
string|null $passphrase Passphrase to use with the PEM file
boolean $validate Set to false to skip the validation of the certificate, default true
string|null $endpointEnv APNS environment this certificate is valid for, by default autodetects during validation

Exceptions

InvalidCertificateException
InvalidArgumentException

at line 188
string getPemFile()

Get the path to the PEM file

Return Value

string

at line 198
boolean hasPassphrase()

Checks if there is a passphrase to use with the certificate

Return Value

boolean

at line 208
string getPassphrase()

Passphrase to use with the PEM file

Return Value

string

at line 218
Certificate::ENDPOINT_ENV_PRODUCTION|Certificate::ENDPOINT_ENV_SANDBOX getEnvironment()

Get the APNS environment this certificate is associated with

Return Value

Certificate::ENDPOINT_ENV_PRODUCTION|Certificate::ENDPOINT_ENV_SANDBOX

at line 228
boolean isValidated()

Check if this certificate is validated

Return Value

boolean

at line 238
string getDescription()

An as humanreadable as possible description of the certificate to identify the certificate

Return Value

string

at line 255
DateTime|null getValidFrom()

Get moment this certificate will become valid Note: Will return null if certificate validation was disabled

Return Value

DateTime|null

at line 266
DateTime|null getValidTo()

Get moment this certificate will expire Note: Will return null if certificate validation was disabled

Return Value

DateTime|null

at line 279
string getEndpoint(string $endpointType)

Get the endpoint this certificate is valid for

Parameters

string $endpointType The type of endpoint you want

Return Value

string

Exceptions

InvalidArgumentException

at line 295
string getFingerprint()

Get a unique hash of the certificate this can be used to check if two Apns\Certificate objects are the same

Return Value

string

at line 310
string serialize()

String representation of object

Return Value

string

at line 327
unserialize(string $serialized)

Constructs the object from serialized data

Parameters

string $serialized Serialized data