Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
name: php
version: 8.0.2
version: 9.0.0
schema: 1
scm: github.com/pubnub/php
changelog:
- date: 2025-10-30
version: 9.0.0
changes:
- type: feature
text: "Added limit and offset parameters for hereNow. Number of returned users per channel by default is limited to 1000. Breaking change."
- type: bug
text: "Removed possibility to use deprecated MPNS(Microsoft Push Notification Service). Breaking change."
- type: bug
text: "Added deprecation warning for old APNS PushType. ."
- date: 2025-05-29
version: 8.0.2
changes:
Expand Down Expand Up @@ -534,8 +543,8 @@ sdks:
- x86-64
- distribution-type: library
distribution-repository: GitHub release
package-name: php-8.0.2.zip
location: https://github.com/pubnub/php/releases/tag/8.0.2
package-name: php-9.0.0.zip
location: https://github.com/pubnub/php/releases/tag/9.0.0
requires:
- name: rmccue/requests
min-version: 1.0.0
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## 9.0.0
October 30 2025

#### Added
- Added limit and offset parameters for hereNow. Number of returned users per channel by default is limited to 1000. Breaking change.

#### Fixed
- Removed possibility to use deprecated MPNS(Microsoft Push Notification Service). Breaking change.
- Added deprecation warning for old APNS PushType. .

## 8.0.2
May 29 2025

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ You will need the publish and subscribe keys to authenticate your app. Get your
{
"require": {
<!-- include the latest version from the badge at the top -->
"pubnub/pubnub": "8.0.2"
"pubnub/pubnub": "9.0.0"
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"keywords": ["api", "real-time", "realtime", "real time", "ajax", "push"],
"homepage": "http://www.pubnub.com/",
"license": "proprietary",
"version": "8.0.2",
"version": "9.0.0",
"authors": [
{
"name": "PubNub",
Expand Down
4 changes: 2 additions & 2 deletions examples/basic_usage/mobile_push.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
// Define channels to enable push notifications on
$channelsForPush = ["news", "alerts", "promotions"];

// FCM/GCM device token (typically a long string generated by Firebase)
// FCM device token (typically a long string generated by Firebase)
$deviceId = "fcm-device-registration-token-from-firebase";

try {
// Register the device to receive push notifications on the specified channels
$result = $pubnub->addChannelsToPush()
->pushType(PNPushType::FCM) // Use GCM/FCM for Android devices
->pushType(PNPushType::FCM) // Use FCM for Android devices
->channels($channelsForPush)
->deviceId($deviceId)
->sync();
Expand Down
40 changes: 0 additions & 40 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -5740,11 +5740,6 @@ parameters:
count: 1
path: tests/functional/push/ListPushProvisionsTest.php

-
message: "#^Method Tests\\\\Functional\\\\Push\\\\ListPushProvisionsTest\\:\\:testListChannelGroupMPNS\\(\\) has no return type specified\\.$#"
count: 1
path: tests/functional/push/ListPushProvisionsTest.php

-
message: "#^Method Tests\\\\Functional\\\\Push\\\\RemoveChannelsFromPushExposed\\:\\:buildParams\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
Expand Down Expand Up @@ -5780,11 +5775,6 @@ parameters:
count: 1
path: tests/functional/push/RemoveDeviceFromPushTest.php

-
message: "#^Method Tests\\\\Functional\\\\Push\\\\RemoveDeviceFromPushTest\\:\\:testRemovePushMPNS\\(\\) has no return type specified\\.$#"
count: 1
path: tests/functional/push/RemoveDeviceFromPushTest.php

-
message: "#^Method Tests\\\\Integrational\\\\AddChannelChannelGroupEndpointTest\\:\\:testChannelMissing\\(\\) has no return type specified\\.$#"
count: 1
Expand Down Expand Up @@ -6130,11 +6120,6 @@ parameters:
count: 1
path: tests/integrational/ListPushProvisionsTest.php

-
message: "#^Method Tests\\\\Integrational\\\\Push\\\\ListPushProvisionsTest\\:\\:testMicrosoftSuccess\\(\\) has no return type specified\\.$#"
count: 1
path: tests/integrational/ListPushProvisionsTest.php

-
message: "#^Method Tests\\\\Integrational\\\\Push\\\\ListPushProvisionsTest\\:\\:testNullDeviceId\\(\\) has no return type specified\\.$#"
count: 1
Expand Down Expand Up @@ -6170,11 +6155,6 @@ parameters:
count: 1
path: tests/integrational/ModifyPushChannelsForDeviceTest.php

-
message: "#^Method Tests\\\\Integrational\\\\Push\\\\ModifyPushChannelsForDeviceTest\\:\\:testAddMicrosoftSuccessSync\\(\\) has no return type specified\\.$#"
count: 1
path: tests/integrational/ModifyPushChannelsForDeviceTest.php

-
message: "#^Method Tests\\\\Integrational\\\\Push\\\\ModifyPushChannelsForDeviceTest\\:\\:testAppleSuccessRemove\\(\\) has no return type specified\\.$#"
count: 1
Expand Down Expand Up @@ -6240,16 +6220,6 @@ parameters:
count: 1
path: tests/integrational/ModifyPushChannelsForDeviceTest.php

-
message: "#^Method Tests\\\\Integrational\\\\Push\\\\ModifyPushChannelsForDeviceTest\\:\\:testMicrosoftSuccessRemove\\(\\) has no return type specified\\.$#"
count: 1
path: tests/integrational/ModifyPushChannelsForDeviceTest.php

-
message: "#^Method Tests\\\\Integrational\\\\Push\\\\ModifyPushChannelsForDeviceTest\\:\\:testMicrosoftSuccessRemoveAll\\(\\) has no return type specified\\.$#"
count: 1
path: tests/integrational/ModifyPushChannelsForDeviceTest.php

-
message: "#^Method Tests\\\\Integrational\\\\Push\\\\ModifyPushChannelsForDeviceTest\\:\\:testMissingChannels\\(\\) has no return type specified\\.$#"
count: 1
Expand Down Expand Up @@ -7025,11 +6995,6 @@ parameters:
count: 1
path: tests/integrational/push/ListPushProvisionsEndpointTest.php

-
message: "#^Method Tests\\\\Integrational\\\\Push\\\\ListPushProvisionsEndpointTest\\:\\:testListChannelGroupMPNS\\(\\) has no return type specified\\.$#"
count: 1
path: tests/integrational/push/ListPushProvisionsEndpointTest.php

-
message: "#^Method Tests\\\\Integrational\\\\Push\\\\ListPushProvisionsEndpointTest\\:\\:testWarningWhenUsingDeprecatedGCMType\\(\\) has no return type specified\\.$#"
count: 1
Expand Down Expand Up @@ -7070,11 +7035,6 @@ parameters:
count: 1
path: tests/integrational/push/RemoveDeviceFromPushEndpointTest.php

-
message: "#^Method Tests\\\\Integrational\\\\Push\\\\RemoveDeviceFromPushEndpointTest\\:\\:testRemovePushMPNS\\(\\) has no return type specified\\.$#"
count: 1
path: tests/integrational/push/RemoveDeviceFromPushEndpointTest.php

-
message: "#^Method Tests\\\\Integrational\\\\Push\\\\RemoveDeviceFromPushEndpointTest\\:\\:testWarningWhenUsingDeprecatedGCMType\\(\\) has no return type specified\\.$#"
count: 1
Expand Down
6 changes: 5 additions & 1 deletion src/PubNub/Endpoints/Push/PushEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ protected function validatePushType()
trigger_error("GCM is deprecated. Please use FCM instead.", E_USER_DEPRECATED);
}

if ($this->pushType === PNPushType::APNS) {
trigger_error("APNS is deprecated. Please use APNS2 instead.", E_USER_DEPRECATED);
}

if (!in_array($this->pushType, PNPushType::all())) {
throw new PubNubValidationException("Invalid push type");
}
Expand Down Expand Up @@ -149,6 +153,6 @@ protected function getName()

protected function getPushType(): string
{
return $this->pushType == PNPushType::FCM ? 'gcm' : $this->pushType;
return $this->pushType == PNPushType::FCM ? 'fcm' : $this->pushType;
}
}
14 changes: 10 additions & 4 deletions src/PubNub/Enums/PNPushType.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,24 @@

class PNPushType
{
public const APNS = "apns";
public const APNS2 = "apns2";
public const MPNS = "mpns";
public const GCM = "gcm";
public const FCM = "fcm";

/**
* @deprecated Use APNS2 instead. APNS will be removed in a future version.
*/
public const APNS = "apns";

/**
* @deprecated Use FCM instead. GCM will be removed in a future version.
*/
public const GCM = "gcm";

public static function all()
{
return [
self::APNS,
self::APNS2,
self::MPNS,
self::GCM,
self::FCM
];
Expand Down
2 changes: 1 addition & 1 deletion src/PubNub/PubNub.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@

class PubNub implements LoggerAwareInterface
{
protected const SDK_VERSION = "8.0.2";
protected const SDK_VERSION = "9.0.0";
protected const SDK_NAME = "PubNub-PHP";

public static $MAX_SEQUENCE = 65535;
Expand Down
6 changes: 3 additions & 3 deletions tests/functional/push/AddChannelsToPushTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function testPushAddMultipleChannels()
$add = new AddChannelsToPushExposed($this->pubnub);

$add->channels(["ch1", "ch2"])
->pushType(PNPushType::MPNS)
->pushType(PNPushType::FCM)
->deviceId("coolDevice");

$this->assertEquals(sprintf(
Expand All @@ -55,7 +55,7 @@ public function testPushAddMultipleChannels()
$this->assertEquals([
"pnsdk" => PubNubUtil::urlEncode(PubNub::getSdkFullName()),
"uuid" => $this->pubnub->getConfiguration()->getUuid(),
"type" => "mpns",
"type" => "fcm",
"add" => "ch1,ch2"
], $add->buildParams());

Expand Down Expand Up @@ -110,7 +110,7 @@ public function testPushAddFCM()
$this->assertEquals([
"pnsdk" => PubNubUtil::urlEncode(PubNub::getSdkFullName()),
"uuid" => $this->pubnub->getConfiguration()->getUuid(),
"type" => "gcm",
"type" => "fcm",
"add" => "ch1,ch2,ch3"
], $add->buildParams());

Expand Down
24 changes: 1 addition & 23 deletions tests/functional/push/ListPushProvisionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,29 +75,7 @@ public function testListChannelGroupFCM()
$this->assertEquals([
"pnsdk" => PubNubUtil::urlEncode(PubNub::getSdkFullName()),
"uuid" => $this->pubnub->getConfiguration()->getUuid(),
"type" => "gcm"
], $list->buildParams());
}

public function testListChannelGroupMPNS()
{
$this->pubnub->getConfiguration()->setUuid("sampleUUID");

$list = new ListPushProvisionsExposed($this->pubnub);

$list->pushType(PNPushType::MPNS)
->deviceId("coolDevice");

$this->assertEquals(sprintf(
ListPushProvisions::PATH,
$this->pubnub->getConfiguration()->getSubscribeKey(),
"coolDevice"
), $list->buildPath());

$this->assertEquals([
"pnsdk" => PubNubUtil::urlEncode(PubNub::getSdkFullName()),
"uuid" => $this->pubnub->getConfiguration()->getUuid(),
"type" => "mpns"
"type" => "fcm"
], $list->buildParams());
}
}
Expand Down
6 changes: 3 additions & 3 deletions tests/functional/push/RemoveChannelsFromPushTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function testPushRemoveMultipleChannels()
$remove = new RemoveChannelsFromPushExposed($this->pubnub);

$remove->channels(['ch1', 'ch2'])
->pushType(PNPushType::MPNS)
->pushType(PNPushType::FCM)
->deviceId('coolDevice');

$this->assertEquals(sprintf(
Expand All @@ -53,7 +53,7 @@ public function testPushRemoveMultipleChannels()
$this->assertEquals([
"pnsdk" => PubNubUtil::urlEncode(PubNub::getSdkFullName()),
"uuid" => $this->pubnub->getConfiguration()->getUuid(),
"type" => "mpns",
"type" => "fcm",
"remove" => "ch1,ch2"
], $remove->buildParams());
}
Expand All @@ -77,7 +77,7 @@ public function testPushRemoveFCM()
$this->assertEquals([
"pnsdk" => PubNubUtil::urlEncode(PubNub::getSdkFullName()),
"uuid" => $this->pubnub->getConfiguration()->getUuid(),
"type" => "gcm",
"type" => "fcm",
"remove" => "ch1,ch2,ch3"
], $remove->buildParams());
}
Expand Down
24 changes: 1 addition & 23 deletions tests/functional/push/RemoveDeviceFromPushTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,6 @@ public function testRemovePushAPNS()
], $remove->buildParams());
}

public function testRemovePushMPNS()
{
$this->pubnub->getConfiguration()->setUuid("sampleUUID");

$remove = new RemoveDeviceFromPushExposed($this->pubnub);

$remove->pushType(PNPushType::MPNS)
->deviceId('coolDevice');

$this->assertEquals(sprintf(
RemoveDeviceFromPush::PATH,
$this->pubnub->getConfiguration()->getSubscribeKey(),
"coolDevice"
), $remove->buildPath());

$this->assertEquals([
"pnsdk" => PubNubUtil::urlEncode(PubNub::getSdkFullName()),
"uuid" => $this->pubnub->getConfiguration()->getUuid(),
"type" => "mpns",
], $remove->buildParams());
}

public function testRemovePushFCM()
{
$this->pubnub->getConfiguration()->setUuid("sampleUUID");
Expand All @@ -72,7 +50,7 @@ public function testRemovePushFCM()
$this->assertEquals([
"pnsdk" => PubNubUtil::urlEncode(PubNub::getSdkFullName()),
"uuid" => $this->pubnub->getConfiguration()->getUuid(),
"type" => "gcm",
"type" => "fcm",
], $remove->buildParams());
}
}
Expand Down
Loading
Loading