PHP Class LaravelFCM\Message\PayloadNotificationBuilder

Official google documentation :
Show file Open project: brozot/laravel-fcm Class Usage Examples

Protected Properties

Property Type Description
$badge null | String
$body null | String
$bodyLocationArgs null | String
$bodyLocationKey null | String
$clickAction null | String
$color null | String
$icon null | String
$sound null | String
$tag null | String
$title null | String
$titleLocationArgs null | String
$titleLocationKey null | String

Public Methods

Method Description
__construct ( String $title = null ) Title must be present on android notification and ios (watch) notification
build ( ) : PayloadNotification Build an PayloadNotification
getBadge ( ) : null | String Get Badge
getBody ( ) : null | String Get body
getBodyLocationArgs ( ) : null | String | array Get BodyLocationArgs
getBodyLocationKey ( ) : null | String Get BodyLocationKey
getClickAction ( ) : null | String Get ClickAction
getColor ( ) : null | String Get Color
getIcon ( ) : null | String Get Icon
getSound ( ) : null | String Get Sound
getTag ( ) : null | String Get Tag
getTitle ( ) : null | String Get title
getTitleLocationArgs ( ) : null | String | array GetTitleLocationArgs
getTitleLocationKey ( ) : string Get TitleLocationKey
setBadge ( String $badge ) : PayloadNotificationBuilder Supported Ios
setBody ( String $body ) : PayloadNotificationBuilder Indicates notification body text.
setBodyLocationArgs ( mixed $bodyArgs ) : PayloadNotificationBuilder Indicates the string value to replace format specifiers in the body string for localization.
setBodyLocationKey ( String $bodyKey ) : PayloadNotificationBuilder Indicates the key to the body string for localization.
setClickAction ( String $action ) : PayloadNotificationBuilder Indicates the action associated with a user click on the notification
setColor ( String $color ) : PayloadNotificationBuilder Supported Android
setIcon ( String $icon ) : PayloadNotificationBuilder Supported Android Indicates notification icon. example : Sets value to myicon for drawable resource myicon.
setSound ( String $sound ) : PayloadNotificationBuilder Indicates a sound to play when the device receives a notification.
setTag ( String $tag ) : PayloadNotificationBuilder Supported Android
setTitle ( String $title ) : PayloadNotificationBuilder Indicates notification title. This field is not visible on iOS phones and tablets.
setTitleLocationArgs ( mixed $titleArgs ) : PayloadNotificationBuilder Indicates the string value to replace format specifiers in the title string for localization.
setTitleLocationKey ( String $titleKey ) : PayloadNotificationBuilder Indicates the key to the title string for localization.

Method Details

__construct() public method

Title must be present on android notification and ios (watch) notification
public __construct ( String $title = null )
$title String

build() public method

Build an PayloadNotification
public build ( ) : PayloadNotification
return PayloadNotification

getBadge() public method

Get Badge
public getBadge ( ) : null | String
return null | String

getBody() public method

Get body
public getBody ( ) : null | String
return null | String

getBodyLocationArgs() public method

Get BodyLocationArgs
public getBodyLocationArgs ( ) : null | String | array
return null | String | array

getBodyLocationKey() public method

Get BodyLocationKey
public getBodyLocationKey ( ) : null | String
return null | String

getClickAction() public method

Get ClickAction
public getClickAction ( ) : null | String
return null | String

getColor() public method

Get Color
public getColor ( ) : null | String
return null | String

getIcon() public method

Get Icon
public getIcon ( ) : null | String
return null | String

getSound() public method

Get Sound
public getSound ( ) : null | String
return null | String

getTag() public method

Get Tag
public getTag ( ) : null | String
return null | String

getTitle() public method

Get title
public getTitle ( ) : null | String
return null | String

getTitleLocationArgs() public method

GetTitleLocationArgs
public getTitleLocationArgs ( ) : null | String | array
return null | String | array

getTitleLocationKey() public method

Get TitleLocationKey
public getTitleLocationKey ( ) : string
return string

setBadge() public method

Indicates the badge on the client app home icon.
public setBadge ( String $badge ) : PayloadNotificationBuilder
$badge String
return PayloadNotificationBuilder current instance of the builder

setBody() public method

Indicates notification body text.
public setBody ( String $body ) : PayloadNotificationBuilder
$body String
return PayloadNotificationBuilder current instance of the builder

setBodyLocationArgs() public method

Indicates the string value to replace format specifiers in the body string for localization.
public setBodyLocationArgs ( mixed $bodyArgs ) : PayloadNotificationBuilder
$bodyArgs mixed
return PayloadNotificationBuilder current instance of the builder

setBodyLocationKey() public method

Indicates the key to the body string for localization.
public setBodyLocationKey ( String $bodyKey ) : PayloadNotificationBuilder
$bodyKey String
return PayloadNotificationBuilder current instance of the builder

setClickAction() public method

Indicates the action associated with a user click on the notification
public setClickAction ( String $action ) : PayloadNotificationBuilder
$action String
return PayloadNotificationBuilder current instance of the builder

setColor() public method

Indicates color of the icon, expressed in #rrggbb format
public setColor ( String $color ) : PayloadNotificationBuilder
$color String
return PayloadNotificationBuilder current instance of the builder

setIcon() public method

Supported Android Indicates notification icon. example : Sets value to myicon for drawable resource myicon.
public setIcon ( String $icon ) : PayloadNotificationBuilder
$icon String
return PayloadNotificationBuilder current instance of the builder

setSound() public method

Supports default or the filename of a sound resource bundled in the app.
public setSound ( String $sound ) : PayloadNotificationBuilder
$sound String
return PayloadNotificationBuilder current instance of the builder

setTag() public method

Indicates whether each notification results in a new entry in the notification drawer on Android. If not set, each request creates a new notification. If set, and a notification with the same tag is already being shown, the new notification replaces the existing one in the notification drawer.
public setTag ( String $tag ) : PayloadNotificationBuilder
$tag String
return PayloadNotificationBuilder current instance of the builder

setTitle() public method

but it is required for android
public setTitle ( String $title ) : PayloadNotificationBuilder
$title String
return PayloadNotificationBuilder current instance of the builder

setTitleLocationArgs() public method

Indicates the string value to replace format specifiers in the title string for localization.
public setTitleLocationArgs ( mixed $titleArgs ) : PayloadNotificationBuilder
$titleArgs mixed
return PayloadNotificationBuilder current instance of the builder

setTitleLocationKey() public method

Indicates the key to the title string for localization.
public setTitleLocationKey ( String $titleKey ) : PayloadNotificationBuilder
$titleKey String
return PayloadNotificationBuilder current instance of the builder

Property Details

$badge protected property

protected null|String $badge
return null | String

$body protected property

protected null|String $body
return null | String

$bodyLocationArgs protected property

protected null|String $bodyLocationArgs
return null | String

$bodyLocationKey protected property

protected null|String $bodyLocationKey
return null | String

$clickAction protected property

protected null|String $clickAction
return null | String

$color protected property

protected null|String $color
return null | String

$icon protected property

protected null|String $icon
return null | String

$sound protected property

protected null|String $sound
return null | String

$tag protected property

protected null|String $tag
return null | String

$title protected property

protected null|String $title
return null | String

$titleLocationArgs protected property

protected null|String $titleLocationArgs
return null | String

$titleLocationKey protected property

protected null|String $titleLocationKey
return null | String