Skip to content

fix README.md #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ Currently this app server library only supports sending Messages/Notifications v

See original Firebase docs: https://firebase.google.com/docs/

#Setup
## Setup
Install via Composer:
```
```bash
composer require sngrl/php-firebase-cloud-messaging
```

Or add this to your composer.json and run "composer update":

```
```json
"require": {
"sngrl/php-firebase-cloud-messaging": "dev-master"
}
```

#Send message to Device
```
## Send message to Device
```php
use sngrl\PhpFirebaseCloudMessaging\Client;
use sngrl\PhpFirebaseCloudMessaging\Message;
use sngrl\PhpFirebaseCloudMessaging\Recipient\Device;
Expand All @@ -44,10 +44,10 @@ var_dump($response->getStatusCode());
var_dump($response->getBody()->getContents());
```

#Send message to Topic
## Send message to Topic
Currently sending to topics only supports a single topic as recipient. Mutliple topic as outlined
in the google docs don't seem to work, yet.
```
```php
use sngrl\PhpFirebaseCloudMessaging\Client;
use sngrl\PhpFirebaseCloudMessaging\Message;
use sngrl\PhpFirebaseCloudMessaging\Recipient\Topic;
Expand All @@ -71,8 +71,8 @@ var_dump($response->getStatusCode());
var_dump($response->getBody()->getContents());
```

#Subscribe user to the topic
```
## Subscribe user to the topic
```php
use sngrl\PhpFirebaseCloudMessaging\Client;

$server_key = '_YOUR_SERVER_KEY_';
Expand All @@ -85,8 +85,8 @@ var_dump($response->getStatusCode());
var_dump($response->getBody()->getContents());
```

#Remove user subscription to the topic
```
## Remove user subscription to the topic
```php
use sngrl\PhpFirebaseCloudMessaging\Client;

$server_key = '_YOUR_SERVER_KEY_';
Expand All @@ -97,4 +97,4 @@ $client->injectGuzzleHttpClient(new \GuzzleHttp\Client());
$response = $client->removeTopicSubscription('_SOME_TOPIC_ID_', ['_FIRST_TOKEN_', '_SECOND_TOKEN_']);
var_dump($response->getStatusCode());
var_dump($response->getBody()->getContents());
```
```