New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

emotality/panacea-laravel

Laravel package to send transactional SMSes via PanaceaMobile.
42,661 3
Install
composer require emotality/panacea-laravel
Latest Version:2.1.4
PHP:^8.1
Laravel:10 – 13
Older releases:5 – 9
License:MIT
Last Updated:May 2, 2026
Links: GitHub  ·  Packagist
Maintainer: emotality

PanaceaMobile for Laravel

License Latest Version Total Downloads

Laravel package to send transactional SMSes via PanaceaMobile.

Minimum Requirements

  • PHP 8.1
  • Laravel 10

Installation

  1. composer require emotality/panacea-laravel
  2. php artisan vendor:publish --provider="Emotality\Panacea\PanaceaMobileServiceProvider"
  3. Add the following lines to your .env file:
PANACEA_USERNAME="<panacea_username>"
PANACEA_PASSWORD="<panacea_password_or_api_key>"
PANACEA_FROM="<from_name>" // Optional

Usage

Sending an SMS to a single recipient:

\PanaceaMobile::sms('+27820000001', "1st Line\n2nd Line\n3rd Line");
// or
\PanaceaMobile::sms('+27820000001', "1st Line\n2nd Line\n3rd Line", 'From Name');

Response will be a bool, true if successful, false if unsuccessful.


Sending an SMS to multiple recipients:

\PanaceaMobile::smsMany(['+27820000001', '+27820000002'], "1st Line\n2nd Line\n3rd Line");
// or
\PanaceaMobile::smsMany(['+27820000001', '+27820000002'], "1st Line\n2nd Line\n3rd Line", 'From Name');

Response will be an array where the keys are the recipients' numbers, the values will be booleans:

array:2 [▼
  "+27820000001" => true
  "+27820000002" => false
]

Sending an SMS via notification:

namespace App\Notifications;

use Emotality\Panacea\PanaceaMobileSms;
use Emotality\Panacea\PanaceaMobileSmsChannel;
use Illuminate\Notifications\Notification;

class ExampleNotification extends Notification
{
    // Notification channels
    public function via($notifiable)
    {
        return [PanaceaMobileSmsChannel::class];
    }
    
    // Send SMS
    public function toSms($notifiable) // Can also use toPanacea($notifiable)
    {
        // Send SMS without "to", this value will automatically be fetched from
        // the "routeNotificationForPanacea" method in your notifiable entity.
        // See the "Routing SMS Notifications" section below.
        return (new PanaceaMobileSms())->message("1st Line\n2nd Line\n3rd Line");
        
        // or send SMS to a single recipient, specifying the "to" value
        return (new PanaceaMobileSms())
            ->to($notifiable->mobile) // Assuming $user->mobile is their mobile number
            ->from('From Name') // Optional. Will override config's "from" value.
            ->message("1st Line\n2nd Line\n3rd Line");
            
        // or send SMS to multiple recipients
        return (new PanaceaMobileSms())
            ->toMany(['+27820000001', '+27820000002'])
            ->from('From Name') // Optional. Will override config's "from" value.
            ->message("1st Line\n2nd Line\n3rd Line");
    }
}

Routing SMS Notifications

To route Panacea notifications to the proper phone number, define a routeNotificationForPanacea method on your notifiable entity:

namespace App\Models;
 
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
 
class User extends Authenticatable
{
    use Notifiable;
 
    /**
     * Route notifications for the Panacea channel.
     *
     * @param  \Illuminate\Notifications\Notification  $notification
     * @return string
     */
    public function routeNotificationForPanacea($notification)
    {
        return $this->mobile;
    }
}

License

panacea-laravel is released under the MIT license. See LICENSE for details.

Related Packages

ohanspace/sms

this is a sms package made for laravel

11 0
sms
midnite81/laravel-base

Base Functionality for Laravel

35,582 3
lbhurtado/sms

Driver-based SMS component in Laravel inspired by the tutorial of Orobo Lucky

9,485 0
huangdijia/laravel-sms

sms for laravel

7,402 2
alhaji-aki/laravel-sms

A package that allows developers integrate sms providers and provide a common ap...

5,952 2

Version History

Version Released PHP Laravel License
2.1.4 ^8.1 >10.0 MIT
2.1.3 ^8.1 >10.0 MIT
2.1.2 >=7.2.5 >=7.0.0 MIT
2.1.1 >=7.2.5 >=7.0.0 MIT
2.1.0 >=7.2.5 >=7.0.0 MIT