Download the PHP package alhoqbani/laravel-mobily-ws-notification without Composer
On this page you can find all versions of the php package alhoqbani/laravel-mobily-ws-notification. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download alhoqbani/laravel-mobily-ws-notification
More information about alhoqbani/laravel-mobily-ws-notification
Files in alhoqbani/laravel-mobily-ws-notification
Package laravel-mobily-ws-notification
Short Description Send SMS notifications using mobily.ws with Laravel 5.4
License MIT
Homepage https://github.com/alhoqbani/laravel-mobily-ws-notification
Informations about the package laravel-mobily-ws-notification
Laravel Mobily.ws Notification Channel
This package makes it easy to send notifications using MobilyWs with Laravel 5.4.
Contents
- Installation
- Package Installation
- Set up mobily.ws account
- Usage
- Credentials
- Create Notification
- Routing SMS Notifications
- Sending SMS
- Scheduled SMS
- Available Message methods
- TODO
- Changelog
- Testing
- Security
- Contributing
- License
Installation
Package Installation
Install the package using composer:
Add service provider to your array of providers in config/app.php
You don't need to do this step for laravel 5.5+
Publish the configuration file:
Set up mobily.ws account
You must have an account with MobilyWs to be able to use this package.
This package has no affiliation with mobily.ws whatsoever.
Credentials.
There are two methods of authentication when using mobily.ws api.
You could send requests using your login credentials (mobile/password), or by using the apiKey which you can generate from your mobily.ws account.
You must add mobily.ws credentials to your .env
file.
Which method to use:
You can define the authentication method you would like to use
by editing your config/mobilyws
file.
You could choose: auth
, password
, or auto
.
if you choose auto
, we will look for the apiKey key first,
if not found, we look for the mobile and password
Usage
Create new notification:
Make a new notification class using laravel artisan
and configure the notification class to use MobilyWsChannel.
Or you could use our custom artisan command:
The toMobilyWs
method should return a string of the text message to be sent or an instance of MobilyWsMessage
.
See Available Message methods for more details.
Routing SMS Notifications:
When sending notifications via the MobilyWs
channel, the notification system will automatically look for a phone_number
attribute on the notifiable entity.
If you would like to customize the phone number the notification is delivered to, define a routeNotificationForMobilyWs
method on the entity:
routeNotificationForMobilyWs
should return a mobile number to which the SMS message will be sent.
Please note that the mobile number must start with the country code without leading zeros.
For example, 9665xxxxxxxx
Sending SMS:
Scheduled SMS
MobilyWs Api allows for sending scheduled message which will be sent on the defined date/time.
Please note that if you define time in the past, the message will be sent immediately by mobily.ws. This library will not check if the defined time is in the future.
You can define the time on which the message should be sent by mobily.ws by calling time
method on the MobilyWsMessage instance.
The time
method accepts either a DateTime object or a timestamp.
Available Message methods
In your notification, you must define a method toMobilyWs
which will receive the notifiable entity (e.g User model) and an instance of MobilyWsMessage
.
This method should return the text of the message to be sent as an SMS to mobily.ws or an instance of MobilyWsMessage
.
You can also pass the message to MobilyWsMessage
constructor:
return new MobilyWsMessage("Text message");
or set the text message using the msg()
method:
Method toMobilyWs
will receive an instance of MobilyWsMessage
as the 2nd argument.
list of available methods :
text()
To add the content of the text message
time()
To set time of the scheduled sms.
TODO
- [ ] Validate mobile numbers
- [ ] Validate text messages type and length
- [ ] Validate given time is in the future.
- [x] Verify method
toMobilyWs
existence and config file. - [x] Add the option to send Scheduled SMS
- [ ] Add the the rest of params (MsgID, msgKey, deleteKey,
timeSend,dateSend) - [ ] Translate mobily.ws error messages
- [x] Create artisan command to made mobily.ws notifications
- [ ] Add list of fired event to the documentation.
Changelog
Please see CHANGELOG for more information what has changed recently.
Testing
Contributing
Please see CONTRIBUTING for details.
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-mobily-ws-notification with dependencies
guzzlehttp/guzzle Version ^6.3
illuminate/events Version ^5.4
illuminate/notifications Version ^5.4
illuminate/support Version ^5.4