PHPackages                             sbudah/panaceamobile - 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. sbudah/panaceamobile

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

sbudah/panaceamobile
====================

PanaceaMobile Notifications driver.

0.0.5(9y ago)1271MITPHPPHP &gt;=5.6.4

Since Aug 13Pushed 9y ago1 watchersCompare

[ Source](https://github.com/Sbudah/panaceamobile)[ Packagist](https://packagist.org/packages/sbudah/panaceamobile)[ Docs](https://github.com/sbudah/panaceamobile)[ RSS](/packages/sbudah-panaceamobile/feed)WikiDiscussions master Synced 4w ago

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

PanaceaMobile notifications channel for Laravel 5.3 \[WIP\]
===========================================================

[](#panaceamobile-notifications-channel-for-laravel-53-wip)

[![Latest Version on Packagist](https://camo.githubusercontent.com/812800c6d70cade016dc7eccfee50e0f406643655d9dcbf57006eba461cd9993/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f5362756461682f70616e616365616d6f62696c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/Sbudah/panaceamobile)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/53082f711d22fdaacd751dcee95c14cc497e0a202a461e975509196e0606d905/68747470733a2f2f7472617669732d63692e6f72672f5362756461682f70616e616365616d6f62696c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Sbudah/panaceamobile)[![StyleCI](https://camo.githubusercontent.com/0cc40f91817704dc8a790e86f9121777e293ae2c3e748db68c894eba156c4964/68747470733a2f2f7374796c6563692e696f2f7265706f732f36353538393435312f736869656c64)](https://styleci.io/repos/65589451)[![SensioLabsInsight](https://camo.githubusercontent.com/8bf7b10fb398541d8adce86003f2fa8aadd3c5de6cae0c9e84ce878e4234f3e9/68747470733a2f2f696d672e736869656c64732e696f2f73656e73696f6c6162732f692f61636565666532372d626135612d343964372d393036342d6263336162656130616265622e7376673f7374796c653d666c61742d737175617265)](https://insight.sensiolabs.com/projects/aceefe27-ba5a-49d7-9064-bc3abea0abeb)[![Quality Score](https://camo.githubusercontent.com/fcf6ddc59b9bfa11871087b88dba0f718694330d57b7a48af7afb2bd619fa080/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f5362756461682f70616e616365616d6f62696c652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/Sbudah/panaceamobile)[![Total Downloads](https://camo.githubusercontent.com/947b45d02d05bd0f4a5caddb7d2daf28657309e85823bc5afb2944937023574b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f5362756461682f70616e616365616d6f62696c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/Sbudah/panaceamobile)

This package makes it easy to send notifications using [PanaceaMobile](https://www.panaceamobile.com/) with Laravel 5.3.

Contents
--------

[](#contents)

- [Installation](#installation)
    - [Setting up the PanaceaMobile service](#setting-up-the-PanaceaMobile-service)
- [Usage](#usage)
    - [Available Message methods](#available-message-methods)
- [Changelog](#changelog)
- [Testing](#testing)
- [Security](#security)
- [Contributing](#contributing)
- [Credits](#credits)
- [License](#license)

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

[](#installation)

You can install the package via composer:

```
composer require sbudah/panaceamobile
```

You must install the service provider:

```
// config/app.php
'providers' => [
    ...
    NotificationChannels\PanaceaMobile\PanaceaMobileServiceProvider::class,
];
```

### Setting up the PanaceaMobile service

[](#setting-up-the-panaceamobile-service)

Create an account at [Panacea Mobile](https://www.panaceamobile.com/) and create an API token.

Add your PanaceaMobile login, secret key (hashed password) and default sender name to your `config/services.php`:

```
// config/services.php

'panaceamobile' => [
    'login'  => env('PANACEAMOBILE_LOGIN'), // Your Username
    'secret' => env('PANACEAMOBILE_SECRET'), // Your Token
    'sender' => 'Sbudah' // Phone number to send SMS from
]
```

Usage
-----

[](#usage)

You can use the channel in your `via()` method inside the notification:

```
use Illuminate\Notifications\Notification;
use NotificationChannels\PanaceaMobile\PanaceaMobileMessage;
use NotificationChannels\PanaceaMobile\PanaceaMobileChannel;

class AccountApproved extends Notification
{
    public function via($notifiable)
    {
        return [PanaceaMobileChannel::class];
    }

    public function toPanaceaMobile($notifiable)
    {
        return (new PanaceaMobileMessage())
            ->content("Your {$notifiable->service} account was approved!");
    }
}
```

In order to let your Notification know which phone are you sending/calling to, the channel will look for the `phone_number` attribute of the Notifiable model. If you want to override this behaviour, add the `routeNotificationForPanaceaMobile` method to your Notifiable model.

```
// app/User.php

public function routeNotificationForPanaceaMobile()
{
    return '27111000101';
}
```

Example #2

```
