jshar/lara-sender

SENDER.GE Integration for Laravel

Installs: 1

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

Type:project

pkg:composer/jshar/lara-sender

dev-main 2025-08-29 11:33 UTC

This package is not auto-updated.

Last update: 2025-09-27 10:04:28 UTC


README

Packagist Packagist license

laravel-sender

Table of Contents

Installation

To get started, you need to install package:

composer require jshar/lara-sender

If your laravel version is older than 5.5, then add this to your service providers in config/app.php:

'providers' => [
    ...
    Shar\Sender\SenderServiceProvider::class,
    ...
];

You can publish config file using this command:

php artisan vendor:publish --provider="Shar\Sender\SenderServiceProvider"

This command will copy config file in your config directory.

Usage

Send Message

use Shar\Sender\Enums\MessageStatus;
use Shar\Sender\Enums\MessageType;
use Shar\Sender\Facades\Sender;

class SenderController extends Controller
{
    //
    public function __invoke()
    {
        // recipient who should get sms
        $mobile_number = '5XXXXXXXX';
    
        // content of the message
        $message = 'Welcome, you are getting this message from integration';

        // type of the message
        $type = MessageType::Advertising; // MessageType::Information

        $result = Sender::send($mobile_number, $message, $type);
        
        if (isset($result->data[0])) {
            // $result->data[0]->messageId
            // $result->data[0]->statusId

            if ((int)$result->data[0]->statusId === MessageStatus::Delivered) {
                // message has been sent
            }
        } else {
            // message was not sent
        }
    }
} 

Check Status

use Shar\Sender\Enums\MessageStatus;
use Shar\Sender\Facades\Sender;

class SenderController extends Controller
{
    //
    public function __invoke()
    {
        // message id provided by send method
        $message_id = 0000;

        $result = Sender::check($message_id);
        
        if (isset($result->data[0])) {
            // $result->data[0]->messageId
            // $result->data[0]->statusId
            // $result->data[0]->timestamp

            if ((int)$result->data[0]->statusId === MessageStatus::Delivered) {
                // message has been delivered
            }
        } else {
            // message status check failed
        }
    }
} 

Notification

You can use this package as notification channel.

use Illuminate\Notifications\Notification;
use Shar\Sender\Notifications\SMSMessage;
use Shar\Sender\Channels\SenderChannel;
use Illuminate\Support\Facades\Log;

class WelcomeNotification extends Notification
{
    //
    public function via($notifiable)
    {
        return [SenderChannel::class];
    }
    
    //
    public function toSender($notifiable): SMSMessage
    {
        return (new SMSMessage())
            ->content('Your message goes here.')
            ->recipient($notifiable->phone)
            ->callback(function ($response) { // optional
                // use response here
            });
    }
}

Additional Information

MessageType

Message types has its own enum Shar\Sender\Enums\MessageType

Key Value
Advertising 1
Information 2

MessageStatus

Message statuses has its own enum Shar\Sender\Enums\MessageStatus

Key Value
Pending 0
Delivered 1
Undelivered 2

Configuration

You can configure environment file with following variables:

Key Type Default Meaning
SENDER_DEBUG bool false This value decides to log or not to log requests.
SENDER_API_KEY string This is the api key, which should be generated by sender.ge tech stuff.
SENDER_API_URL string https://sender.ge/api This is the url provided by sender.ge support.

License

jshar/lara-sender is licensed under a MIT License.