Skip to content

Commit 5e9faf5

Browse files
Removed MPNS, deprecated old APNS (#124)
* Removed possibility to use deprecated PushType MPNS - Microsoft Push Notification Service. * Added deprecation warning for old APNS PushType. * In case FCM is chosen as PushType type REST query param gets fcm value instead of gcm. * PubNub SDK 9.0.0 release. --------- Co-authored-by: PubNub Release Bot <120067856+pubnub-release-bot@users.noreply.github.com>
1 parent 3e196c3 commit 5e9faf5

19 files changed

+272
-323
lines changed

.pubnub.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
name: php
2-
version: 8.0.2
2+
version: 9.0.0
33
schema: 1
44
scm: github.com/pubnub/php
55
changelog:
6+
- date: 2025-10-30
7+
version: 9.0.0
8+
changes:
9+
- type: feature
10+
text: "Added limit and offset parameters for hereNow. Number of returned users per channel by default is limited to 1000. Breaking change."
11+
- type: bug
12+
text: "Removed possibility to use deprecated MPNS(Microsoft Push Notification Service). Breaking change."
13+
- type: bug
14+
text: "Added deprecation warning for old APNS PushType. ."
615
- date: 2025-05-29
716
version: 8.0.2
817
changes:
@@ -534,8 +543,8 @@ sdks:
534543
- x86-64
535544
- distribution-type: library
536545
distribution-repository: GitHub release
537-
package-name: php-8.0.2.zip
538-
location: https://github.com/pubnub/php/releases/tag/8.0.2
546+
package-name: php-9.0.0.zip
547+
location: https://github.com/pubnub/php/releases/tag/9.0.0
539548
requires:
540549
- name: rmccue/requests
541550
min-version: 1.0.0

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## 9.0.0
2+
October 30 2025
3+
4+
#### Added
5+
- Added limit and offset parameters for hereNow. Number of returned users per channel by default is limited to 1000. Breaking change.
6+
7+
#### Fixed
8+
- Removed possibility to use deprecated MPNS(Microsoft Push Notification Service). Breaking change.
9+
- Added deprecation warning for old APNS PushType. .
10+
111
## 8.0.2
212
May 29 2025
313

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ You will need the publish and subscribe keys to authenticate your app. Get your
4141
{
4242
"require": {
4343
<!-- include the latest version from the badge at the top -->
44-
"pubnub/pubnub": "8.0.2"
44+
"pubnub/pubnub": "9.0.0"
4545
}
4646
}
4747
```

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"keywords": ["api", "real-time", "realtime", "real time", "ajax", "push"],
66
"homepage": "http://www.pubnub.com/",
77
"license": "proprietary",
8-
"version": "8.0.2",
8+
"version": "9.0.0",
99
"authors": [
1010
{
1111
"name": "PubNub",

examples/basic_usage/mobile_push.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
// Define channels to enable push notifications on
2121
$channelsForPush = ["news", "alerts", "promotions"];
2222

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

2626
try {
2727
// Register the device to receive push notifications on the specified channels
2828
$result = $pubnub->addChannelsToPush()
29-
->pushType(PNPushType::FCM) // Use GCM/FCM for Android devices
29+
->pushType(PNPushType::FCM) // Use FCM for Android devices
3030
->channels($channelsForPush)
3131
->deviceId($deviceId)
3232
->sync();

phpstan-baseline.neon

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5740,11 +5740,6 @@ parameters:
57405740
count: 1
57415741
path: tests/functional/push/ListPushProvisionsTest.php
57425742

5743-
-
5744-
message: "#^Method Tests\\\\Functional\\\\Push\\\\ListPushProvisionsTest\\:\\:testListChannelGroupMPNS\\(\\) has no return type specified\\.$#"
5745-
count: 1
5746-
path: tests/functional/push/ListPushProvisionsTest.php
5747-
57485743
-
57495744
message: "#^Method Tests\\\\Functional\\\\Push\\\\RemoveChannelsFromPushExposed\\:\\:buildParams\\(\\) return type has no value type specified in iterable type array\\.$#"
57505745
count: 1
@@ -5780,11 +5775,6 @@ parameters:
57805775
count: 1
57815776
path: tests/functional/push/RemoveDeviceFromPushTest.php
57825777

5783-
-
5784-
message: "#^Method Tests\\\\Functional\\\\Push\\\\RemoveDeviceFromPushTest\\:\\:testRemovePushMPNS\\(\\) has no return type specified\\.$#"
5785-
count: 1
5786-
path: tests/functional/push/RemoveDeviceFromPushTest.php
5787-
57885778
-
57895779
message: "#^Method Tests\\\\Integrational\\\\AddChannelChannelGroupEndpointTest\\:\\:testChannelMissing\\(\\) has no return type specified\\.$#"
57905780
count: 1
@@ -6130,11 +6120,6 @@ parameters:
61306120
count: 1
61316121
path: tests/integrational/ListPushProvisionsTest.php
61326122

6133-
-
6134-
message: "#^Method Tests\\\\Integrational\\\\Push\\\\ListPushProvisionsTest\\:\\:testMicrosoftSuccess\\(\\) has no return type specified\\.$#"
6135-
count: 1
6136-
path: tests/integrational/ListPushProvisionsTest.php
6137-
61386123
-
61396124
message: "#^Method Tests\\\\Integrational\\\\Push\\\\ListPushProvisionsTest\\:\\:testNullDeviceId\\(\\) has no return type specified\\.$#"
61406125
count: 1
@@ -6170,11 +6155,6 @@ parameters:
61706155
count: 1
61716156
path: tests/integrational/ModifyPushChannelsForDeviceTest.php
61726157

6173-
-
6174-
message: "#^Method Tests\\\\Integrational\\\\Push\\\\ModifyPushChannelsForDeviceTest\\:\\:testAddMicrosoftSuccessSync\\(\\) has no return type specified\\.$#"
6175-
count: 1
6176-
path: tests/integrational/ModifyPushChannelsForDeviceTest.php
6177-
61786158
-
61796159
message: "#^Method Tests\\\\Integrational\\\\Push\\\\ModifyPushChannelsForDeviceTest\\:\\:testAppleSuccessRemove\\(\\) has no return type specified\\.$#"
61806160
count: 1
@@ -6240,16 +6220,6 @@ parameters:
62406220
count: 1
62416221
path: tests/integrational/ModifyPushChannelsForDeviceTest.php
62426222

6243-
-
6244-
message: "#^Method Tests\\\\Integrational\\\\Push\\\\ModifyPushChannelsForDeviceTest\\:\\:testMicrosoftSuccessRemove\\(\\) has no return type specified\\.$#"
6245-
count: 1
6246-
path: tests/integrational/ModifyPushChannelsForDeviceTest.php
6247-
6248-
-
6249-
message: "#^Method Tests\\\\Integrational\\\\Push\\\\ModifyPushChannelsForDeviceTest\\:\\:testMicrosoftSuccessRemoveAll\\(\\) has no return type specified\\.$#"
6250-
count: 1
6251-
path: tests/integrational/ModifyPushChannelsForDeviceTest.php
6252-
62536223
-
62546224
message: "#^Method Tests\\\\Integrational\\\\Push\\\\ModifyPushChannelsForDeviceTest\\:\\:testMissingChannels\\(\\) has no return type specified\\.$#"
62556225
count: 1
@@ -7025,11 +6995,6 @@ parameters:
70256995
count: 1
70266996
path: tests/integrational/push/ListPushProvisionsEndpointTest.php
70276997

7028-
-
7029-
message: "#^Method Tests\\\\Integrational\\\\Push\\\\ListPushProvisionsEndpointTest\\:\\:testListChannelGroupMPNS\\(\\) has no return type specified\\.$#"
7030-
count: 1
7031-
path: tests/integrational/push/ListPushProvisionsEndpointTest.php
7032-
70336998
-
70346999
message: "#^Method Tests\\\\Integrational\\\\Push\\\\ListPushProvisionsEndpointTest\\:\\:testWarningWhenUsingDeprecatedGCMType\\(\\) has no return type specified\\.$#"
70357000
count: 1
@@ -7070,11 +7035,6 @@ parameters:
70707035
count: 1
70717036
path: tests/integrational/push/RemoveDeviceFromPushEndpointTest.php
70727037

7073-
-
7074-
message: "#^Method Tests\\\\Integrational\\\\Push\\\\RemoveDeviceFromPushEndpointTest\\:\\:testRemovePushMPNS\\(\\) has no return type specified\\.$#"
7075-
count: 1
7076-
path: tests/integrational/push/RemoveDeviceFromPushEndpointTest.php
7077-
70787038
-
70797039
message: "#^Method Tests\\\\Integrational\\\\Push\\\\RemoveDeviceFromPushEndpointTest\\:\\:testWarningWhenUsingDeprecatedGCMType\\(\\) has no return type specified\\.$#"
70807040
count: 1

src/PubNub/Endpoints/Push/PushEndpoint.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ protected function validatePushType()
6666
trigger_error("GCM is deprecated. Please use FCM instead.", E_USER_DEPRECATED);
6767
}
6868

69+
if ($this->pushType === PNPushType::APNS) {
70+
trigger_error("APNS is deprecated. Please use APNS2 instead.", E_USER_DEPRECATED);
71+
}
72+
6973
if (!in_array($this->pushType, PNPushType::all())) {
7074
throw new PubNubValidationException("Invalid push type");
7175
}
@@ -149,6 +153,6 @@ protected function getName()
149153

150154
protected function getPushType(): string
151155
{
152-
return $this->pushType == PNPushType::FCM ? 'gcm' : $this->pushType;
156+
return $this->pushType == PNPushType::FCM ? 'fcm' : $this->pushType;
153157
}
154158
}

src/PubNub/Enums/PNPushType.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,24 @@
44

55
class PNPushType
66
{
7-
public const APNS = "apns";
87
public const APNS2 = "apns2";
9-
public const MPNS = "mpns";
10-
public const GCM = "gcm";
118
public const FCM = "fcm";
129

10+
/**
11+
* @deprecated Use APNS2 instead. APNS will be removed in a future version.
12+
*/
13+
public const APNS = "apns";
14+
15+
/**
16+
* @deprecated Use FCM instead. GCM will be removed in a future version.
17+
*/
18+
public const GCM = "gcm";
19+
1320
public static function all()
1421
{
1522
return [
1623
self::APNS,
1724
self::APNS2,
18-
self::MPNS,
1925
self::GCM,
2026
self::FCM
2127
];

src/PubNub/PubNub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969

7070
class PubNub implements LoggerAwareInterface
7171
{
72-
protected const SDK_VERSION = "8.0.2";
72+
protected const SDK_VERSION = "9.0.0";
7373
protected const SDK_NAME = "PubNub-PHP";
7474

7575
public static $MAX_SEQUENCE = 65535;

tests/functional/push/AddChannelsToPushTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function testPushAddMultipleChannels()
4343
$add = new AddChannelsToPushExposed($this->pubnub);
4444

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

4949
$this->assertEquals(sprintf(
@@ -55,7 +55,7 @@ public function testPushAddMultipleChannels()
5555
$this->assertEquals([
5656
"pnsdk" => PubNubUtil::urlEncode(PubNub::getSdkFullName()),
5757
"uuid" => $this->pubnub->getConfiguration()->getUuid(),
58-
"type" => "mpns",
58+
"type" => "fcm",
5959
"add" => "ch1,ch2"
6060
], $add->buildParams());
6161

@@ -110,7 +110,7 @@ public function testPushAddFCM()
110110
$this->assertEquals([
111111
"pnsdk" => PubNubUtil::urlEncode(PubNub::getSdkFullName()),
112112
"uuid" => $this->pubnub->getConfiguration()->getUuid(),
113-
"type" => "gcm",
113+
"type" => "fcm",
114114
"add" => "ch1,ch2,ch3"
115115
], $add->buildParams());
116116

0 commit comments

Comments
 (0)