PHPPHP V4 Mobile Push API Reference for Realtime Apps

Go to Storage & Playback


 

These docs are for PubNub 4.x for PHP which is our latest and greatest! For the docs of the older versions of the SDK, please check PubNub 3.x for PHP.

If you have questions about the PubNub for PHP SDK, please contact us at support@pubnub.com.

Requires Mobile Push Notifications add-on XRequires that the Mobile Push Notifications add-on is enabled for your key. See this page on enabling add-on features on your keys:

http://www.pubnub.com/knowledge-base/discussion/644/how-do-i-enable-add-on-features-for-my-keys.
Enable push notifications on provided set of channels.
To run Adding Device to Channel you can use the following method(s) in the PHP V4 SDK
  1. ParameterTypeRequiredDefaultsDescription
    pushTypePNPushTypeYesNot setAccepted values: PNPushType.GCM, PNPushType.APNS, PNPushType.MPNS.
    channelsArrayYesAdd push notifications on the specified channels.
    deviceIdStringYesDevice id.
use PubNub\Enums\PNPushType;

$pubnub->addChannelsToPush()
    ->pushType(PNPushType::GCM)
    ->channels(["ch1", "ch2", "ch3"])
    ->deviceId("deviceId")
    ->sync();
Requires Mobile Push Notifications add-on XRequires that the Mobile Push Notifications add-on is enabled for your key. See this page on enabling add-on features on your keys:

http://www.pubnub.com/knowledge-base/discussion/644/how-do-i-enable-add-on-features-for-my-keys.
Request for all channels on which push notification has been enabled using specified pushToken.
To run Listing Channels For Device you can use the following method(s) in the PHP V4 SDK
  1. ParameterTypeRequiredDefaultsDescription
    pushTypePNPushTypeYesNot setAccepted values: PNPushType.GCM, PNPushType.APNS, PNPushType.MPNS.
    deviceIdStringYesDevice id.
$pubnub->arrayPushProvisions()
    ->pushType(PNPushType::GCM)
    ->deviceId("deviceId")
    ->sync();
MethodTypeDescription
getChannels()ArrayList of channels subscribed for push notifications.
Requires Mobile Push Notifications add-on XRequires that the Mobile Push Notifications add-on is enabled for your key. See this page on enabling add-on features on your keys:

http://www.pubnub.com/knowledge-base/discussion/644/how-do-i-enable-add-on-features-for-my-keys.
Disable push notifications on provided set of channels. If nil will be passed as channels then client will remove push notifications from all channels which associated with pushToken.
To run Removing Device From Channel you can use the following method(s) in the PHP V4 SDK
  1. ParameterTypeRequiredDefaultsDescription
    pushTypePNPushTypeYesNot setAccepted values: PNPushType.GCM, PNPushType.APNS, PNPushType.MPNS.
    channelsString|ArrayYesRemove push notifications from the specified channels.
    deviceIdStringYesDevice id.
use PubNub\Enums\PNPushType;

$pubnub->removeChannelsFromPush()
    ->pushType(PNPushType::GCM)
    ->channels(["ch1", "ch2", "ch3"])
    ->deviceId("deviceId")
    ->sync();

Go to MISCELLANEOUS