adobkin / php-apn

php-apn is a PHP module, to introduce simple yet powerful interface for sending push notifications to iOS and OS X devices from within your PHP code
http://libcapn.org/php-apn
Other
77 stars 16 forks source link

Feature request: Ability to set "title" (child property of "alert") in payload #14

Open rbottarelli opened 8 years ago

rbottarelli commented 8 years ago

The "alert" key of the payload can be a dictionary with properties defined in table 5-2 in the Apple docs:

https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/TheNotificationPayload.html#//apple_ref/doc/uid/TP40008194-CH107-SW4

Among the properties are "title" and "body" but currently only "body" is supported by php-apn.

title (string): A short string describing the purpose of the notification. Apple Watch displays this string as part of the notification interface. This string is displayed only briefly and should be crafted so that it can be understood quickly. This key was added in iOS 8.2.

body (string): The text of the alert message.

I suggest updating the function apn_payload_set_array to support "title" and adding a new function apn_payload_set_title to set it individually.