@@ -23,16 +23,23 @@ With more endpoints to come. Feel free to contribute.
2323
2424## Contents
2525
26- - [ Installation] ( #installation )
27- - [Setting up the 46Elks service](#setting-up-the-46Elks-service)
28- - [ Usage] ( #usage )
29- - [Available Message methods](#available-message-methods)
30- - [ Changelog] ( #changelog )
31- - [ Testing] ( #testing )
32- - [ Security] ( #security )
33- - [ Contributing] ( #contributing )
34- - [ Credits] ( #credits )
35- - [ License] ( #license )
26+ - [ 46Elks notification channel for Laravel] ( #46elks-notification-channel-for-laravel )
27+ - [ Contents] ( #contents )
28+ - [ Installation] ( #installation )
29+ - [ Setting up the 46Elks service] ( #setting-up-the-46elks-service )
30+ - [ Usage] ( #usage )
31+ - [ Available mediums] ( #available-mediums )
32+ - [ SMS] ( #sms )
33+ - [ Available Message methods for sms] ( #available-message-methods-for-sms )
34+ - [ MMS] ( #mms )
35+ - [ Available Message methods] ( #available-message-methods )
36+ - [ Error handling] ( #error-handling )
37+ - [ Changelog] ( #changelog )
38+ - [ Testing] ( #testing )
39+ - [ Security] ( #security )
40+ - [ Contributing] ( #contributing )
41+ - [ Credits] ( #credits )
42+ - [ License] ( #license )
3643
3744
3845## Installation
@@ -45,7 +52,7 @@ composer require laravel-notification-channels/46elks
4552
4653
4754add the following to your config/services.php
48- ```
55+ ``` php
4956 '46elks' => [
5057 'username' => env('FORTY_SIX_ELKS_USERNAME'),
5158 'password' => env('FORTY_SIX_ELKS_PASSWORD'),
@@ -63,33 +70,52 @@ You will find your username and password at https://46elks.se/account
6370
6471
6572To use this channel simply create a notification that has the following content:
73+ ``` php
74+ use NotificationChannels\FortySixElks\FortySixElksChannel;
75+ use NotificationChannels\FortySixElks\FortySixElksSMS;
76+
77+ public function via($notifiable)
78+ {
79+ return [FortySixElksChannel::class];
80+ }
81+
82+
83+ public function to46Elks($notifiable)
84+ {
85+ return (new FortySixElksSMS())
86+ ->line('Testsms')
87+ ->line('Olle')
88+ ->to('+46701234567')
89+ ->from('Emil')
90+ // ->flash() - Optional
91+ // ->whenDelivered(URL) - Optional
92+ // ->dontLog() - Optional
93+ // ->dry() - Optional
94+ }
6695```
67- use NotificationChannels\FortySixElks\FortySixElksChannel;
68- use NotificationChannels\FortySixElks\FortySixElksSMS;
69-
70- public function via($notifiable)
71- {
72- return [FortySixElksChannel::class];
73- }
7496
75-
76- public function to46Elks($notifiable)
77- {
78- return (new FortySixElksSMS())
79- ->line('Testsms')
80- ->line('Olle')
81- ->to('+46762216234')
82- ->from('Emil')
83- // -dry()
84- }
97+ Another example without the notification implementation.
98+ ``` php
99+ use NotificationChannels\FortySixElks\FortySixElksSMS;
100+
101+ (new FortySixElksSMS())
102+ ->line('Testsms')
103+ ->line('Olle')
104+ ->to('+46701234567')
105+ ->from('Emil')
106+ // ->flash() - Optional
107+ // ->whenDelivered(URL) - Optional
108+ // ->dontLog() - Optional
109+ // ->dry() - Optional
110+ ->send();
85111```
86112### Available mediums
87113#### SMS
88114The FortySixElksSMS have the following methods, all chainable.
89115### Available Message methods for sms
90116
91117
92- `` from($mixed) `` Accepts a string up to 11 characters or number . Sms will be sent with that name.
118+ `` from($mixed) `` Accepts a string containing A-Z, a-z, 0-9 up to 11 characters or numbers. Space is not supported . Sms will be sent with that name.
93119
94120`` to($number) `` International phone number.
95121
@@ -101,9 +127,9 @@ The FortySixElksSMS have the following methods, all chainable.
101127 No SMS message will be sent when this is enabled. To be able inspect a dry() request you need to
102128 send your message to +4670000000 then you can inspect it at [ https://46elks.com/logs ] ( https://46elks.com/logs )
103129
104- `` whendelivered ('http://localhost')`` This webhook URL will receive a POST request every time the delivery status changes.
130+ `` whenDelivered ('http://localhost.se/ping ')`` This webhook URL will receive a POST request every time the delivery status changes.
105131
106- `` dontlog ()`` Enable to avoid storing the message text in your history.
132+ `` dontLog ()`` Enable to avoid storing the message text in your history.
107133 The other parameters will still be stored.
108134
109135#### MMS
@@ -130,7 +156,7 @@ If for any reason there would be an error when sending a notification it will fi
130156` Illuminate\Notifications\Events\NotificationFailed ` event. You can then listen for that.
131157
132158Example:
133- ```
159+ ``` php
134160Event::listen(NotificationFailed::class, function($event){
135161 info('Error while sending sms');
136162});
0 commit comments