New

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

macellan/netgsm

Netgsm SMS notification channel for Laravel
5,945 3
Install
composer require macellan/netgsm
Latest Version:v2.1.0
PHP:^8.1
Laravel:10 – 13
Older releases:8 · 9
License:MIT
Last Updated:Jul 4, 2026
Links: GitHub  ·  Packagist
Maintainer: epicentre

Netgsm SMS Notification Channel for Laravel

Tests Latest Stable Version Total Downloads

This package makes it easy to send sms notifications using Netgsm with Laravel 10.x, 11.x, 12.x

Contents

Installation

You can install this package via composer:

composer require macellan/netgsm

Setting up the Netgsm service

Add your Netgsm configs to your config/services.php:

// config/services.php
...
    'sms' => [
        'netgsm' => [
            'username' => env('NETGSM_USERNAME', ''),
            'password' => env('NETGSM_PASSWORD', ''),
            'header' => env('NETGSM_HEADER', ''),
            'language' => env('NETGSM_LANGUAGE', 'tr'),
            'enable' => env('NETGSM_ENABLE', false),
            'debug' => env('NETGSM_DEBUG', false), // Will log sending attempts and results
            'sandbox_mode' => env('NETGSM_SANDBOX_MODE', false), // Will not invoke API call
        ],
    ],
...

Usage

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

use Illuminate\Notifications\Notification;
use Macellan\Netgsm\DTO\Sms\BaseSmsMessage;
use Macellan\Netgsm\DTO\Sms\SmsMessage;

class TestNotification extends Notification
{
    public function via($notifiable)
    {
        return ['netgsm'];
    }

    public function toNetgsm(object $notifiable): BaseSmsMessage
    {
        return new SmsMessage('Netgsm test message');
    }
}

For Otp Sms sending, OtpSmsMessage class can be returned.

return new OtpSmsMessage('Netgsm otp test message');

In your notifiable model, make sure to include a routeNotificationForSms() method, which returns a phone number.

public function routeNotificationForSms()
{
    return $this->phone;
}

On-Demand Notifications

Sometimes you may need to send a notification to someone who is not stored as a "user" of your application. Using the Notification::route method, you may specify ad-hoc notification routing information before sending the notification:

Notification::route('sms', '+905554443322')  
            ->notify(new TestNotification());

Usage With Facade

use Macellan\Netgsm\Facades\Netgsm;
use Macellan\Netgsm\DTO\Sms\SmsMessage;
use Macellan\Netgsm\DTO\Sms\OtpSmsMessage;

// Sms send - single sms
$smsMessage = (new SmsMessage('Netgsm test message'))
    ->setNumbers(['+905554443322']);
Netgsm::sendSms($smsMessage);
/**
// return array 
[
    'code' => '00', // Netgsm response code
    'id' => '17377215342605050417149344',  // Job id,
    'description" => 'queued',
]
**/

// Sms send - bulk sms with same message
$smsMessage = (new SmsMessage('Netgsm test message'))
    ->setNumbers(['+905554443322', '+905554443333']);
Netgsm::sendSms($smsMessage);

// Sms send - bulk sms
$smsMessage = (new SmsMessage)
    ->setNumbers(['+905554443322', '+905554443333'])
    ->setMessages(['Message 1', 'Message 2']);
Netgsm::sendSms($smsMessage);

// Otp Sms send
$otpSmsMessage = (new OtpSmsMessage('Netgsm otp test message'))
    ->setNumbers(['+905554443322']);
Netgsm::sendSms($otpSmsMessage);
/**
// return array 
[
    'code' => '00', // Netgsm response code
    'id' => '111111', // Job id
    'error' => '', // Error message
]
**/

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Credits

Related Packages

macellan/twilio

Twilio SMS notification channel for Laravel

3,779 2
racoonsoftware/netgsm

Laravel 5.1 Net Gsm Sms service package

44 0
zing/laravel-sms

Provides sms notification channel for Laravel.

5,527 8
lab123/aws-sns

Amazon SNS notification channels (SMS and topics) for Laravel

28,811 31
taiwan-sms/every8d

every8d sms api client

19,416 17

Version History

Version Released PHP Laravel License
v2.1.0 ^8.1 ^10.0|^11.0|^12.0|^13.0 MIT
v2.0.0 ^8.1 ^10.0|^11.0|^12.0 MIT
v1.1.0 ^8.1 ^8.0|^9.0|^10.0|^11.0 MIT
v1.0.1 ^8.1 ^8.0|^9.0|^10.0 MIT
v1.0.0 ^8.1 ^8.0|^9.0|^10.0 MIT