Skip to content

Commit 2261827

Browse files
committed
Minor updates to the readme, adjust Markdown formatting
1 parent a1ceea2 commit 2261827

File tree

1 file changed

+36
-33
lines changed

1 file changed

+36
-33
lines changed

README.md

Lines changed: 36 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ This package makes it easy to send Pushover notifications with Laravel Notificat
1313
## Contents
1414

1515
- [Installation](#installation)
16-
- [Setting up your Pushover account](#setting-up-your-pushover-account)
16+
- [Setting up your Pushover account](#setting-up-your-pushover-account)
1717
- [Usage](#usage)
18-
- [Available Message methods](#available-message-methods)
18+
- [Advanved usage and configuration](#advanced-usage-and-configuration)
19+
- [Available Message methods](#available-message-methods)
1920
- [Changelog](#changelog)
2021
- [Testing](#testing)
2122
- [Security](#security)
@@ -27,28 +28,27 @@ This package makes it easy to send Pushover notifications with Laravel Notificat
2728

2829
You can install the package via composer:
2930

30-
``` bash
31+
```bash
3132
composer require laravel-notification-channels/pushover
3233
```
3334

3435
### Setting up your Pushover account
3536

3637
To start sending messages via Pushover, you have to [register an application](https://pushover.net/apps/build).
3738
Add the generated Pushover application token to the services config file:
39+
3840
```php
3941
// config/services.php
40-
...
4142
'pushover' => [
4243
'token' => 'YOUR_APPLICATION_TOKEN',
4344
],
44-
...
4545
```
4646

4747
## Usage
4848

4949
Now you can use the channel in your `via()` method inside the notification as well as send a push notification:
5050

51-
``` php
51+
```php
5252
use NotificationChannels\Pushover\PushoverChannel;
5353
use NotificationChannels\Pushover\PushoverMessage;
5454
use Illuminate\Notifications\Notification;
@@ -71,18 +71,21 @@ class AccountApproved extends Notification
7171
}
7272
```
7373

74-
Make sure there is a `routeNotificationForPushover` method on your notifiable model, for instance:
75-
``` php
76-
...
74+
To send Pushover notifications to the notifiable entity, add the `routeNotificationForPushover` method to that model.
75+
Usually, this is the User model. The `pushover_key` could be a database field and editable by the user itself.
76+
77+
```php
7778
public function routeNotificationForPushover()
7879
{
7980
return $this->pushover_key;
8081
}
8182
```
8283

84+
### Advanced usage and configuration
85+
8386
If you want to specify specific devices, you can return a `PushoverReceiver` object.
87+
8488
```php
85-
...
8689
public function routeNotificationForPushover() {
8790
return PushoverReceiver::withUserKey('pushover-key')
8891
->toDevice('iphone')
@@ -92,50 +95,50 @@ public function routeNotificationForPushover() {
9295
}
9396
```
9497

95-
If you want to (dynamically) overrule the application token from the services config, e.g. because each user holds their own application token, return a `PushoverReceiver` object like this:
98+
If you want to (dynamically) overrule the application token from the services config, e.g. because each user holds their
99+
own application token, return a `PushoverReceiver` object like this:
100+
96101
```php
97-
...
98102
public function routeNotificationForPushover() {
99103
return PushoverReceiver::withUserKey('pushover-key')
100104
->withApplicationToken('app-token');
101105
}
102106
```
103107

104108
You can also send a message to a Pushover group:
109+
105110
```php
106-
...
107111
public function routeNotificationForPushover() {
108112
return PushoverReceiver::withGroupKey('pushover-group-key');
109113
}
110114
```
111115

112116
### Available Message methods
113-
Please note that only the message content is mandatory, all other methods are optional. The message content can be set via `content('')`, via the create method `PushoverMessage::create('')` or via the constructor `new PushoverMessage('')`.
114-
115-
Method | Description
116-
-| -
117-
`content($message)` | Accepts a string value for the message text.
118-
`html()` | Sets the message type to [HTML](https://pushover.net/api#html).
119-
`monospace()` | Sets the message type to monospace.
120-
`plain()` | Sets the message type to plain text, this is the default.
121-
`title($title)` | Accepts a string value for the message title.
122-
`time($timestamp)` | Accepts either a `Carbon` object or a UNIX timestamp.
123-
`url($url[, $title])` | Accepts a string value for a [supplementary url](https://pushover.net/api#urls) and an optional string value for the title of the url.
124-
`sound($sound)` | Accepts a string value for the [notification sound](https://pushover.net/api#sounds).
125-
`image($image)` | Accepts a string value for the image location (either full or relative server path or a URL). If there is any error with the file (too big, not an image) it will silently send the message without the image attachment.
126-
`priority($priority[, $retryTimeout, $expireAfter])` | Accepts an integer value for the priority and, when the priority is set to emergency, also an integer value for the retry timeout and expiry time (in seconds). Priority values are available as constants | `PushoverMessage::LOWEST_PRIORITY`, `PushoverMessage::LOW_PRIORITY`, `PushoverMessage::NORMAL_PRIORITY` and `PushoverMessage::EMERGENCY_PRIORITY`.
127-
`lowestPriority()` | Sets the priority to the lowest priority.
128-
`lowPriority()` | Sets the priority to low.
129-
`normalPriority()` | Sets the priority to normal.
130-
`highPriority()` | Sets the priority to high.
131-
`emergencyPriority($retryTimeout, $expireAfter)` | Sets the priority to emergency and accepts integer values for the retry timeout and expiry time (in seconds).
117+
118+
| Method | Description |
119+
|--------|-------------|
120+
| `content($message)` | Accepts a string value for the message text. |
121+
| `html()` | Sets the message type to [HTML](https://pushover.net/api#html). |
122+
| `monospace()` | Sets the message type to monospace. |
123+
| `plain()` | Sets the message type to plain text, this is the default. |
124+
| `title($title)` | Accepts a string value for the message title. |
125+
| `time($timestamp)` | Accepts either a `Carbon` object or a UNIX timestamp. |
126+
| `url($url[, $title])` | Accepts a string value for a [supplementary url](https://pushover.net/api#urls) and an optional string value for the title of the url. |
127+
| `sound($sound)` | Accepts a string value for the [notification sound](https://pushover.net/api#sounds). |
128+
| `image($image)` | Accepts a string value for the image location (either full or relative server path or a URL). If there is any error with the file (too big, not an image) it will silently send the message without the image attachment. |
129+
| `priority($priority[, $retryTimeout, $expireAfter])` | Accepts an integer value for the priority and, when the priority is set to emergency, also an integer value for the retry timeout and expiry time (in seconds). Priority values are available as constants | `PushoverMessage::LOWEST_PRIORITY`, `PushoverMessage::LOW_PRIORITY`, `PushoverMessage::NORMAL_PRIORITY` and `PushoverMessage::EMERGENCY_PRIORITY`. |
130+
| `lowestPriority()` | Sets the priority to the lowest priority. |
131+
| `lowPriority()` | Sets the priority to low. |
132+
| `normalPriority()` | Sets the priority to normal. |
133+
| `highPriority()` | Sets the priority to high. |
134+
| `emergencyPriority($retryTimeout, $expireAfter)` | Sets the priority to emergency and accepts integer values for the retry timeout and expiry time (in seconds). |
132135

133136
## Changelog
134137

135138
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
136139

137140
## Testing
138-
141+
139142
``` bash
140143
$ composer test
141144
```

0 commit comments

Comments
 (0)