Skip to content

Commit 8fd0a74

Browse files
committed
📝 Update README
1 parent 2f14ee0 commit 8fd0a74

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

README.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ A PHP library to send push notification with [Firebase Cloud Messaging](https://
1111

1212
## Warning
1313

14-
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 you are on Legacy HTTP API, then you should consider using version `1.x`
14+
Version `3.x` of this library is a full rewrite using [PSR-18 HTTP Client](https://www.php-fig.org/psr/psr-18/) interface,
15+
which means that **no** HTTP Client, like [Guzzle](https://github.com/guzzle/guzzle) or [httplug](https://github.com/php-http/httplug),
16+
are provided within. If you already have one in your project, the package will **automatically discover it** and use it.
17+
Otherwise You will need to require one separately.
1518

1619
## Installation
1720

@@ -30,22 +33,22 @@ You will then need to:
3033
```php
3134
use Kerox\Fcm\Fcm;
3235
use Kerox\Fcm\Model\Message;
33-
use Kerox\Fcm\Model\Message\Notification;
36+
use Kerox\Fcm\Model\Notification\Notification
37+
use Kerox\Fcm\Model\Target
3438

3539
$fcm = new Fcm('<oauth_token>', '<project_id>');
3640

37-
// Create a notification
38-
$notification = new Notification('Hello World');
39-
$notification->setBody('My awesome Hello World!');
40-
4141
// Create the message
42-
$message = new Message($notification);
43-
$message->setData([
44-
'data-1' => 'Lorem ipsum',
45-
'data-2' => '1234',
46-
'data-3' => 'true'
47-
]);
48-
$message->setToken('1');
42+
$message = new Message(
43+
notification: new Notification(
44+
title: 'Hello World',
45+
body: 'My awesome Hello World!'
46+
),
47+
target: new Token('TopicA'),
48+
data: [
49+
'story_id' => 'story_12345',
50+
],
51+
)
4952

5053
// Send the message and get the response
5154
$response = $fcm->send()->message($message);

0 commit comments

Comments
 (0)