PHPackages                             alhoqbani/laravel-mobily-ws-notification - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. alhoqbani/laravel-mobily-ws-notification

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

alhoqbani/laravel-mobily-ws-notification
========================================

Send SMS notifications using mobily.ws with Laravel 5.4

0.1.0(8y ago)104844[1 issues](https://github.com/alhoqbani/laravel-mobily-ws-notification/issues)MITPHPPHP &gt;=5.6.4

Since Aug 15Pushed 7y ago3 watchersCompare

[ Source](https://github.com/alhoqbani/laravel-mobily-ws-notification)[ Packagist](https://packagist.org/packages/alhoqbani/laravel-mobily-ws-notification)[ Docs](https://github.com/alhoqbani/laravel-mobily-ws-notification)[ RSS](/packages/alhoqbani-laravel-mobily-ws-notification/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (3)Dependencies (6)Versions (7)Used By (0)

Laravel Mobily.ws Notification Channel
======================================

[](#laravel-mobilyws-notification-channel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/dd946d964a50a9fa76909b482f5f2c97226bdba569d325f5d7fb3e9527f96a09/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616c686f7162616e692f6c61726176656c2d6d6f62696c792d77732d6e6f74696669636174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/alhoqbani/laravel-mobily-ws-notification)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/b8b3a92426a0de9c2cd1be608820b56fa02ee3d896bb26276e0d92ec20a4655a/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f616c686f7162616e692f6c61726176656c2d6d6f62696c792d77732d6e6f74696669636174696f6e2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/alhoqbani/laravel-mobily-ws-notification)[![Code Coverage](https://camo.githubusercontent.com/fb23445444de0ce94d37ec46b12518c173a09e11f43fab440a3c6e4cd43e25d4/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f616c686f7162616e692f6c61726176656c2d6d6f62696c792d77732d6e6f74696669636174696f6e2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/alhoqbani/laravel-mobily-ws-notification/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/d381d5ed215c3fbd69288cbd8cf9e9095ea7fbf4eec41e5aa63e396a5789aca2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616c686f7162616e692f6c61726176656c2d6d6f62696c792d77732d6e6f74696669636174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/alhoqbani/laravel-mobily-ws-notification)

This package makes it easy to send notifications using [MobilyWs](https://www.mobily.ws) with Laravel 5.4.

Contents
--------

[](#contents)

- [Installation](#installation)
    - [Package Installation](#package-installation)
    - [Set up mobily.ws account](#set-up-mobily.ws-account)
- [Usage](#usage)
    - [Credentials](#credentials)
    - [Create Notification](#create-notification)
    - [Routing SMS Notifications](#routing-sms-notifications)
    - [Sending SMS](#sending-sms)
    - [Scheduled SMS](#scheduled-sms)
    - [Available Message methods](#available-message-methods)
- [TODO](#todo)
- [Changelog](#changelog)
- [Testing](#testing)
- [Security](#security)
- [Contributing](#contributing)
- [License](#license)

Installation
------------

[](#installation)

### Package Installation

[](#package-installation)

Install the package using composer:

```
composer require alhoqbani/laravel-mobily-ws-notification
```

Add service provider to your array of providers in `config/app.php`

> You don't need to do this step for laravel 5.5+

```
        NotificationChannels\MobilyWs\MobilyWsServiceProvider::class,
```

Publish the configuration file:

```
php artisan vendor:publish --provider="NotificationChannels\MobilyWs\MobilyWsServiceProvider"
```

### Set up mobily.ws account

[](#set-up-mobilyws-account)

You must have an account with [MobilyWs](https://www.mobily.ws) to be able to use this package.

> This package has no affiliation with mobily.ws whatsoever.

#### Credentials.

[](#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.

```
# Mobile number and password used for log in.
MOBILY_WS_MOBILE=
MOBILY_WS_PASSWORD=
# or your apiKey:
MOBILY_WS_API_KEY=
# name/number of the sender which must be approved by mobily.ws for GCC
MOBILY_WS_SENDER=

```

##### Which method to use:

[](#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

```
// config/mobilyws

    // Authentication mode
    'authentication' => 'auto',

    // Set yor login credentials to communicate with mobily.ws Api
    'mobile' => env('MOBILY_WS_MOBILE'),
    'password' =>  env('MOBILY_WS_PASSWORD'),

    // Or use the generated apiKey from your mobily.ws account
    'apiKey' => env('MOBILY_WS_API_KEY'),

    // Name of Sender must be approved by mobily.ws
    'sender' => env('MOBILY_WS_SENDER'),
```

Usage
-----

[](#usage)

### Create new notification:

[](#create-new-notification)

Make a new notification class using laravel artisan

```
php artisan make:notification UserRegistered
```

and configure the notification class to use MobilyWsChannel.

Or you could use our custom artisan command:

```
php artisan mobilyws:notification UserRegistered
```

The `toMobilyWs` method should return a string of the text message to be sent or an instance of `MobilyWsMessage`.

See [Available Message methods](#available-message-methods) for more details.

```
