|
2 | 2 |
|
3 | 3 | The Fcm library follows [SemVer](http://semver.org/). |
4 | 4 |
|
| 5 | +## 3.x |
| 6 | + |
| 7 | +> [!NOTE] |
| 8 | +> Version `3.x` of this library is a full rewrite using [PSR-18 HTTP Client](https://www.php-fig.org/psr/psr-18/) interface, |
| 9 | +> which means that **no** HTTP Client, like [Guzzle](https://github.com/guzzle/guzzle) or [httplug](https://github.com/php-http/httplug), |
| 10 | +> are provided within. If you already have one in your project, the package will **automatically discover it** and use it. |
| 11 | +> Otherwise You will need to require one separately. |
| 12 | +
|
| 13 | +### 3.2 |
| 14 | + |
| 15 | +> [!WARNING] |
| 16 | +> Version `3.2` introduce a BC break. |
| 17 | +> The signature of the `__construct()` method of the `Kerox\Fcm\Model\Message` class has changed, with the `$notification` parameter becoming the third argument and being optional. |
| 18 | +
|
| 19 | +```diff |
| 20 | +final class Message |
| 21 | +{ |
| 22 | +- public Notification $notification; |
| 23 | ++ public ?Notification $notification = null; |
| 24 | + public ?string $token = null; |
| 25 | + public ?string $topic = null; |
| 26 | + public ?string $condition = null; |
| 27 | + |
| 28 | + /** |
| 29 | + * @param array<string, string> $data |
| 30 | + */ |
| 31 | + public function __construct( |
| 32 | +- Notification|string $notification, |
| 33 | + Token|Topic|Condition $target, |
| 34 | + public array $data = [], |
| 35 | ++ Notification|string|null $notification = null, |
| 36 | + public ?AndroidConfig $android = null, |
| 37 | + public ?WebpushConfig $webpush = null, |
| 38 | + public ?ApnsConfig $apns = null, |
| 39 | + public ?FcmOptions $fcmOptions = null, |
| 40 | + ) { |
| 41 | + + if (null !== $notification) { |
| 42 | + $this->notification = \is_string($notification) |
| 43 | + ? new Notification($notification) |
| 44 | + : $notification |
| 45 | + ; |
| 46 | ++ } |
| 47 | + |
| 48 | + match (true) { |
| 49 | + $target instanceof Token => $this->token = $target->__toString(), |
| 50 | + $target instanceof Topic => $this->topic = $target->__toString(), |
| 51 | + $target instanceof Condition => $this->condition = $target->__toString(), |
| 52 | + }; |
| 53 | + } |
| 54 | +} |
| 55 | +``` |
| 56 | +#### Before |
| 57 | + |
| 58 | +````php |
| 59 | +$message = new Message( |
| 60 | + notification: 'Breaking News', |
| 61 | + target: new Topic('TopicA'), |
| 62 | + data: [ |
| 63 | + 'story_id' => 'story_12345', |
| 64 | + ], |
| 65 | +); |
| 66 | +```` |
| 67 | + |
| 68 | +#### After |
| 69 | + |
| 70 | +````php |
| 71 | +$message = new Message( |
| 72 | + target: new Topic('TopicA'), |
| 73 | + data: [ |
| 74 | + 'story_id' => 'story_12345', |
| 75 | + ], |
| 76 | + notification: 'Breaking News', |
| 77 | +); |
| 78 | +```` |
| 79 | + |
| 80 | +### 3.1 |
| 81 | + |
| 82 | +#### What's Changed |
| 83 | +* :bug: Fix README by @ker0x in https://github.com/ker0x/fcm/pull/23 and https://github.com/ker0x/fcm/pull/25 |
| 84 | +* :bug: Fix .gitattributes by @ker0x in https://github.com/ker0x/fcm/pull/24 |
| 85 | +* :arrow_up: Bump Symfony components to `6.4`, allow Symfony 7 by @ker0x in https://github.com/ker0x/fcm/pull/25 |
| 86 | +* :green_heart: Update CI workflow by @ker0x in https://github.com/ker0x/fcm/pull/25 |
| 87 | +* :rotating_light: Fix PHP-CS-Fixer and PHPStan warning by @ker0x in https://github.com/ker0x/fcm/pull/25 |
| 88 | + |
| 89 | +**Full Changelog**: https://github.com/ker0x/fcm/compare/3.0.0...3.1.0 |
| 90 | + |
| 91 | +### 3.0 |
| 92 | + |
| 93 | +#### What's Changed |
| 94 | +* :art: Full package refactoring by @ker0x in https://github.com/ker0x/fcm/pull/21 |
| 95 | +* :memo: Update README by @ker0x in https://github.com/ker0x/fcm/pull/22 |
| 96 | + |
| 97 | +**Full Changelog**: https://github.com/ker0x/fcm/compare/2.4.0...3.0.0 |
| 98 | + |
5 | 99 | ## 2.x |
6 | 100 |
|
7 | | -Version `2.x` of this library is a full rewrite to be compliant with [HTTP v1 API](https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages). If |
8 | | -you are on Legacy HTTP API, then you should consider using version `1.x` |
9 | | - |
10 | | -**Changelog** (since [`2.2.0`](https://github.com/ker0x/fcm/compare/2.2.0...2.3.0)) |
11 | | - |
12 | | -- 2.3.0 (2021-02) |
13 | | - - Bump minimal PHP version to `7.3` |
14 | | - - Bump Guzzle version to `7.2` |
15 | | - - Bump PHPUnit version to `8.` |
16 | | - - Update `.gitattributes` |
17 | | - - Update CI workflow |
18 | | - |
19 | | -**Changelog** (since [`2.1.0`](https://github.com/ker0x/fcm/compare/2.1.0...2.2.0)) |
20 | | - |
21 | | -- 2.2.0 (2020-10) |
22 | | - - Add direct_book_ok parameter for Android configuration. |
23 | | - - Change test namespace from `Tests\Kerox\Fcm` to `Kerox\Fcm\Tests` |
24 | | - - Update PHPStan to `0.12` |
25 | | - |
26 | | -**Changelog** (since [`2.0.0`](https://github.com/ker0x/fcm/compare/2.0.0...2.1.0)) |
27 | | - |
28 | | -- 2.1.0 (2020-01) |
29 | | - - Change class properties visibility from `protected` to `private`. |
30 | | - - Add new configurations classes |
31 | | - * `Kerox\Fcm\Model\Message\Notification\AndroidNotification\Color::class` |
32 | | - * `Kerox\Fcm\Model\Message\Notification\AndroidNotification\LightSettings::class` |
33 | | - * `Kerox\Fcm\Model\Message\Notification\ApnsNotification\Sound::class` |
34 | | - - Add new options classes |
35 | | - * `Kerox\Fcm\Model\Message\Options\AndroidOptions::class` |
36 | | - * `Kerox\Fcm\Model\Message\Options\ApnsOptions::class` |
37 | | - * `Kerox\Fcm\Model\Message\Options\WebpushOptions::class` |
38 | | - - `Kerox\Fcm\Model\Message\Notification\AndroidNotification::class`: add new properties |
39 | | - * `$channelId` |
40 | | - * `$ticker` |
41 | | - * `$sticky` |
42 | | - * `$eventTime` |
43 | | - * `$localOnly` |
44 | | - * `$notificationPriority` |
45 | | - * `$defaultSound` |
46 | | - * `$defaultVibrateTimings` |
47 | | - * `$defaultLightSettings` |
48 | | - * `$vibrateTimings` |
49 | | - * `$visibility` |
50 | | - * `$lightSettings` |
51 | | - * `$image` |
52 | | - - `Kerox\Fcm\Model\Message\Notification\ApnsNotification\Alert::class`: add new properties |
53 | | - * `$subTitle` |
54 | | - * `$subTitleLocKey` |
55 | | - * `$subTitleLocArgs` |
56 | | - - `Kerox\Fcm\Model\Message\Android::class`: add new property `$options`. |
57 | | - - `Kerox\Fcm\Model\Message\Apns::class`: add new property `$options`. |
58 | | - - Method `Kerox\Fcm\Model\Message\Webpush::setOptions()`, type `array` is deprecated, use class `Kerox\Fcm\Model\Message\Options\WebpushOptions::class` |
59 | | - instead. |
60 | | - - Method `Kerox\Fcm\Model\Message\AbstractNotification\Alert::setActionLocKey()` is deprecated and will be removed in 3.0 with no replacement. |
61 | | - |
62 | | -**Changelog** (since [`1.0.1`](https://github.com/ker0x/fcm/compare/1.0.1...2.0.0)) |
63 | | - |
64 | | -- 2.0.0 (2018-09) |
65 | | - - Rewrite library to be compatible with [HTTP v1 API](https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages) |
66 | | - - Improve tests |
67 | | - - Refactor code |
68 | | - - Move documentation to the [Wiki](https://github.com/ker0x/fcm/wiki) section of the repo |
| 101 | +> [!NOTE] |
| 102 | +> Version `2.x` of this library is a full rewrite to be compliant with [HTTP v1 API](https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages). If |
| 103 | +> you are on Legacy HTTP API, then you should consider using version `1.x` |
| 104 | +
|
| 105 | +### 2.4 |
| 106 | + |
| 107 | +#### What's Changed |
| 108 | +* Typo by @tin-cat in https://github.com/ker0x/fcm/pull/17 |
| 109 | +* Add PHP 8.1 to CI by @ker0x in https://github.com/ker0x/fcm/pull/18 |
| 110 | +* fix: setBadge var type by @demmmmios in https://github.com/ker0x/fcm/pull/19 |
| 111 | +* Fix tests by @ker0x in https://github.com/ker0x/fcm/pull/20 |
| 112 | + |
| 113 | +**Full Changelog**: https://github.com/ker0x/fcm/compare/2.3.0...2.4.0 |
0 commit comments