Push
in package
Table of Contents
Constants
- APN_MAX_PAYLOAD_LENGTH = 2048
- APPLE_PUSH_ENDPOINT = "ssl://gateway.push.apple.com:2195"
- APPLE_SANDBOX_PUSH_ENDPOINT = "ssl://gateway.sandbox.push.apple.com:2195"
- FCM_MAX_PAYLOAD_LENGTH = 4096
- MAX_NOTIFICATION_BODY_LENGTH = 200
Properties
- $config : mixed
- $dataMessagePayloadTemplate : array<string|int, mixed>
Methods
- getAppleWWDRCAPath() : string
- getCloudMessagingParent() : mixed
- getPemCertificatePassphrase() : null|string
- getPemCertificatePath() : string
- getWebPushPrivateKey() : string
- getWebPushPublicKey() : string
- getWebsitePushId() : string
- log() : mixed
- Log Push related error messages to their own file.
- sendDataMessage() : mixed
- Sends a data message to a user or to a provided set of devices identified by their Firebase Cloud Messaging (FCM) registration token.
- sendMobileBadgeUpdateDataMessage() : void
- Updates a user's app badge
- sendNotification() : void|bool
- Sends push notifications to a particular user to everywhere he is subscribed for it. This class method will also send corresponding badge update data messages to the user.
- init() : mixed
- filterMobileRegistrationIdsWhereSessionInvalid() : mixed
- Receives a set of FCM tokens to which notifications will be sent and removes those which are linked to devices that have signed in but have been overly inactive or where the user does not have an active session.
- sendMobilePushNotifications() : void|mixed
- sendSafariPushNotification() : mixed
Constants
APN_MAX_PAYLOAD_LENGTH
public
int
APN_MAX_PAYLOAD_LENGTH
= 2048
APPLE_PUSH_ENDPOINT
public
string
APPLE_PUSH_ENDPOINT
= "ssl://gateway.push.apple.com:2195"
APPLE_SANDBOX_PUSH_ENDPOINT
public
string
APPLE_SANDBOX_PUSH_ENDPOINT
= "ssl://gateway.sandbox.push.apple.com:2195"
FCM_MAX_PAYLOAD_LENGTH
public
int
FCM_MAX_PAYLOAD_LENGTH
= 4096
Tags
MAX_NOTIFICATION_BODY_LENGTH
public
int
MAX_NOTIFICATION_BODY_LENGTH
= 200
Properties
$config
private
static mixed
$config
= array()
$dataMessagePayloadTemplate
private
static array<string|int, mixed>
$dataMessagePayloadTemplate
= array("message" => array("android" => array("priority" => "high"), "apns" => array("headers" => array("apns-push-type" => "background", 'apns-priority' => "5"), "payload" => array("aps" => array("content-available" => 1))), "data" => array()))
Methods
getAppleWWDRCAPath()
public
static getAppleWWDRCAPath() : string
Tags
Return values
stringgetCloudMessagingParent()
public
static getCloudMessagingParent() : mixed
getPemCertificatePassphrase()
public
static getPemCertificatePassphrase() : null|string
Return values
null|stringgetPemCertificatePath()
public
static getPemCertificatePath([mixed $fileProtocol = false ]) : string
Parameters
- $fileProtocol : mixed = false
Return values
stringgetWebPushPrivateKey()
public
static getWebPushPrivateKey() : string
Return values
stringgetWebPushPublicKey()
public
static getWebPushPublicKey() : string
Return values
stringgetWebsitePushId()
public
static getWebsitePushId() : string
Return values
stringlog()
Log Push related error messages to their own file.
public
static log(array<string|int, mixed>|Exception $errorRecord) : mixed
Parameters
- $errorRecord : array<string|int, mixed>|Exception
sendDataMessage()
Sends a data message to a user or to a provided set of devices identified by their Firebase Cloud Messaging (FCM) registration token.
public
static sendDataMessage(array<string|int, mixed> $options) : mixed
Parameters
- $options : array<string|int, mixed>
-
The options to use in sending the data message
Tags
sendMobileBadgeUpdateDataMessage()
Updates a user's app badge
public
static sendMobileBadgeUpdateDataMessage( $user, mixed $badge) : void
Parameters
sendNotification()
Sends push notifications to a particular user to everywhere he is subscribed for it. This class method will also send corresponding badge update data messages to the user.
public
static sendNotification(string $title, $user[, array<string|int, mixed> $otherOptions = array() ]) : void|bool
Parameters
- $title : string
-
The title of the push notification messages
- $user :
-
The user to send the push notification messages to
- $otherOptions : array<string|int, mixed> = array()
-
Other options to use in sending the push notification messages
Return values
void|boolinit()
protected
static init() : mixed
filterMobileRegistrationIdsWhereSessionInvalid()
Receives a set of FCM tokens to which notifications will be sent and removes those which are linked to devices that have signed in but have been overly inactive or where the user does not have an active session.
private
static filterMobileRegistrationIdsWhereSessionInvalid(array<string|int, mixed> $mobileRegistrationTokens) : mixed
Parameters
- $mobileRegistrationTokens : array<string|int, mixed>
sendMobilePushNotifications()
private
static sendMobilePushNotifications(array<string|int, mixed> $registrationTokens, array<string|int, mixed> $payload) : void|mixed
Parameters
- $registrationTokens : array<string|int, mixed>
- $payload : array<string|int, mixed>
Tags
Return values
void|mixedsendSafariPushNotification()
private
static sendSafariPushNotification(mixed $deviceTokens, string $payload) : mixed
Parameters
- $deviceTokens : mixed
- $payload : string