PHPackages                             macellan/netgsm - 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. macellan/netgsm

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

macellan/netgsm
===============

Netgsm SMS notification channel for Laravel

v2.0.0(1y ago)34.8k↓28.6%MITPHPPHP ^8.1

Since Jun 7Pushed 1y ago4 watchersCompare

[ Source](https://github.com/macellan/netgsm)[ Packagist](https://packagist.org/packages/macellan/netgsm)[ Docs](https://macellan.net)[ RSS](/packages/macellan-netgsm/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (10)Versions (5)Used By (0)

Netgsm SMS Notification Channel for Laravel
===========================================

[](#netgsm-sms-notification-channel-for-laravel)

[![Tests](https://github.com/macellan/netgsm/actions/workflows/tests.yml/badge.svg)](https://github.com/macellan/netgsm/actions/workflows/tests.yml/badge.svg)[![Latest Stable Version](https://camo.githubusercontent.com/39b417b2e7de88c7fe8d483913be64fbdedaea167b4cbc081039f06ec1b289b1/68747470733a2f2f706f7365722e707567782e6f72672f6d6163656c6c616e2f6e657467736d2f762f737461626c65)](https://packagist.org/packages/macellan/netgsm)[![Total Downloads](https://camo.githubusercontent.com/6a20170a000ff4c630c445e82a8f883b79080f69905c2537bda61301ac68d661/68747470733a2f2f706f7365722e707567782e6f72672f6d6163656c6c616e2f6e657467736d2f646f776e6c6f616473)](https://packagist.org/packages/macellan/netgsm)

This package makes it easy to send sms notifications using [Netgsm](https://www.netgsm.com.tr/dokuman) with Laravel 10.x, 11.x, 12.x

Contents
--------

[](#contents)

- [Installation](#installation)
    - [Setting up the Netgsm service](#setting-up-the-Netgsm-service)
- [Usage](#usage)
    - [ On-Demand Notifications](#on-demand-notifications)
    - [ Usage With Facade](#usage-with-facade)
- [Testing](#testing)
- [Changelog](#changelog)
- [Credits](#credits)

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

[](#installation)

You can install this package via composer:

```
composer require macellan/netgsm
```

### Setting up the Netgsm service

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

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

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

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

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Credits
-------

[](#credits)

- [Arif Demir](https://github.com/epicentre)

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance45

Moderate activity, may be stable

Popularity25

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 62.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~215 days

Total

4

Last Release

432d ago

Major Versions

v1.1.0 → v2.0.02025-03-13

### Community

Maintainers

![](https://www.gravatar.com/avatar/fea6ab8454f28af0ac4265b6f7dcbb97c4881dd978aaabd9fa49be0767db4b24?d=identicon)[aytekin](/maintainers/aytekin)

![](https://www.gravatar.com/avatar/55ec06052d90f6008e382b949e1e7006daa38508300635fab5eac829f983bba2?d=identicon)[epicentre](/maintainers/epicentre)

---

Top Contributors

[![epicentre](https://avatars.githubusercontent.com/u/2106557?v=4)](https://github.com/epicentre "epicentre (5 commits)")[![faytekin](https://avatars.githubusercontent.com/u/4013224?v=4)](https://github.com/faytekin "faytekin (3 commits)")

---

Tags

laravelnotificationsmsnetgsmmacellan

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/macellan-netgsm/health.svg)

```
[![Health](https://phpackages.com/badges/macellan-netgsm/health.svg)](https://phpackages.com/packages/macellan-netgsm)
```

###  Alternatives

[laravel-notification-channels/telegram

Telegram Notifications Channel for Laravel

1.1k3.4M35](/packages/laravel-notification-channels-telegram)[laravel-notification-channels/twilio

Provides Twilio notification channel for Laravel

2587.7M12](/packages/laravel-notification-channels-twilio)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)[s-ichikawa/laravel-sendgrid-driver

This library adds a 'sendgrid' mail driver to Laravel.

4139.3M1](/packages/s-ichikawa-laravel-sendgrid-driver)[tzsk/sms

A robust and unified SMS gateway integration package for Laravel, supporting multiple providers.

320244.3k6](/packages/tzsk-sms)[gr8shivam/laravel-sms-api

A modern, flexible Laravel package for integrating any SMS gateway with REST API support

10138.4k](/packages/gr8shivam-laravel-sms-api)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
