PHPackages                             pw/laragammu - 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. pw/laragammu

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

pw/laragammu
============

Gammu Notifications Driver

029PHP

Since Feb 20Pushed 7y ago1 watchersCompare

[ Source](https://github.com/PurwadiPw/laragammu)[ Packagist](https://packagist.org/packages/pw/laragammu)[ RSS](/packages/pw-laragammu/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Gammu Notifications Channel for Laravel 5.3
===========================================

[](#gammu-notifications-channel-for-laravel-53)

[![Latest Version on Packagist](https://camo.githubusercontent.com/464f8f61e175257f4dd07714a6e19596470e30aa1c3c13d950555c54b76f899c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f70772f67616d6d752e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pw/gammu)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/19f442039146eac8f8429d7d041c1f20b2891a893abcab6ccf69f14d00a75901/68747470733a2f2f7472617669732d63692e6f72672f70772f67616d6d752e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/pw/gammu)[![StyleCI](https://camo.githubusercontent.com/bf65e32f513682dc379d908619a5a28f18bce2e42afdbc36da843f99105e8f6b/68747470733a2f2f7374796c6563692e696f2f7265706f732f36373136333930382f736869656c64)](https://styleci.io/repos/67163908)[![SensioLabsInsight](https://camo.githubusercontent.com/04e9f19cf601e41c361d1a1916e5ee20016d66e96296235b6eb9f2d986115ddb/68747470733a2f2f696d672e736869656c64732e696f2f73656e73696f6c6162732f692f63623939373066392d366439362d343431322d623462622d6439336134336461616334302e7376673f7374796c653d666c61742d737175617265)](https://insight.sensiolabs.com/projects/cb9970f9-6d96-4412-b4bb-d93a43daac40)[![Quality Score](https://camo.githubusercontent.com/99c14abc8c9cdcfc7851713ba943928b3ce17e7fcae5a52aa2d9e23f7d37fb17/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f70772f67616d6d752e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/pw/gammu)[![Total Downloads](https://camo.githubusercontent.com/1d1810f56f6eb53ee7d861adc78c6f86bc48a98f6af42bc0b479c97de2697dd3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f70772f67616d6d752e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pw/gammu)

This package makes it easy to send SMS notifications using [Gammu SMSD](https://wammu.eu/smsd/) with Laravel 5.3.

Contents
--------

[](#contents)

- [Requirements](#requirements)
- [Installation](#installation)
    - [Setting Up Gammu Service](#setting-up-gammu-service)
        - [Using Native Gammu SMSD Method](#using-native-gammu-smsd-method)
        - [Using Gammu Api](#using-gammu-api)
- [Usage](#usage)
    - [Routing a message](#routing-a-message)
    - [Available Message methods](#available-methods)
- [Changelog](#changelog)
- [Testing](#testing)
- [Security](#security)
- [Contributing](#contributing)
- [Credits](#credits)
- [License](#license)

Requirements
------------

[](#requirements)

### Gammu

[](#gammu)

Make sure your Gammu SMSD has properly configured and able to send SMS. For more info to install and configure Gammu SMSD, read the [Gammu SMSD documentation](https://wammu.eu/smsd/).

### Gammu Api

[](#gammu-api)

This is optional if you want to use [Gammu Api](https://github.com/kristiandrucker/gammuApi). Make sure Gammu Api has properly configured and able to send SMS using this API.

Under the hood, Gammu Api is using `gammu sendsms` command line.

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

[](#installation)

You can install the package via composer:

```
composer require pw/gammu
```

You must install the service provider:

```
// config/app.php
'providers' => [
    ...
    Pw\Gammu\GammuServiceProvider::class,
],
```

### Setting Up Gammu Service

[](#setting-up-gammu-service)

There are two methods to send SMS using Gammu. First method is using native Gammu SMSD method, by inserting data directly to Gammu SMSD database. The second method is using Gammu Api.

#### Using Native Gammu SMSD Method

[](#using-native-gammu-smsd-method)

Make sure your Gammu SMSD has properly configured and able to send SMS by inserting data to `outbox` table. The Gammu SMSD and database can be installed in the same machine or in different machine.

Add this settings in `config/services.php` to send SMS using native Gammu method.

```
...
'gammu' => [
    'method' => env('GAMMU_METHOD', 'db'),
    'sender' => env('GAMMU_SENDER', null),
],
...
```

Set the database setting to point Gammu SMSD database in `config/database.php` by adding this settings below.

```
// config/database.php
...
'connections' => [
    ...
    'gammu' => [
        'driver' => 'mysql',
        'host' => env('DB_GAMMU_HOST', 'localhost'),
        'port' => env('DB_GAMMU_PORT', '3306'),
        'database' => env('DB_GAMMU_DATABASE', 'forge'),
        'username' => env('DB_GAMMU_USERNAME', 'forge'),
        'password' => env('DB_GAMMU_PASSWORD', ''),
        'charset' => 'utf8',
        'collation' => 'utf8_unicode_ci',
        'prefix' => '',
        'strict' => true,
        'engine' => null,
    ],
    ...
],
...
```

The sender is the default sender name defined in `phones` table. If it's not set, it will automatically select the first data from `phones` table. This setting is useful if you have multiple sender.

#### Using Gammu Api

[](#using-gammu-api)

Make sure your Gammu Api has properly configured and able to send SMS via it's API. The Gammu Api can be installed in the same machine or in different machine.

Add these settings in `config/services.php` to send SMS.

```
...
'gammu' => [
    'method' => env('GAMMU_METHOD', 'api'),
    'auth' => env('GAMMU_AUTH', 'gammu-api-key'),
    'url' => env('GAMMU_URL', 'http://gammu.api/')
],
...
```

### Using Gammu Api with Redis

[](#using-gammu-api-with-redis)

Make sure, that your Redis server is running and it's able to communicate with your application and gammu api. You are also able to specify `->channel('name-channel')` for using multiple Gammu Api's or have it on a non-default channel.

```
...
'gammu' => [
    'method' => env('GAMMU_METHOD', 'redis')
],
...
```

Usage
-----

[](#usage)

You can now use the channel in your `via()` method inside the Notification class.

```
namespace App\Notifications;

use Pw\Gammu\GammuChannel;
use Pw\Gammu\GammuMessage;
use Illuminate\Notifications\Notification;

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

    public function toGammu($notifiable)
    {
        return (new GammuMessage())
            ->to($phoneNumber)
            ->content($content);
    }
}
```

If you have multiple senders, you can set the sender by passing `sender` method. If sender is not set, it will use one of sender from `phones` table. This method is only available if you're using native Gammu SMSD method.

```
public function toGammu($notifiable)
{
    return (new GammuMessage())
        ->to($phoneNumber)
        ->sender($sender)
        ->content($content);
}
```

### Routing a message

[](#routing-a-message)

You can either send the notification by providing with the phone number of the recipient to the `to($phoneNumber)` method like shown in the above example or add a `routeNotificationForGammu()` method in your notifiable model.

```
...
/**
 * Route notifications for the Gammu channel.
 *
 * @return string
 */
public function routeNotificationForGammu()
{
    return $this->phone;
}
...
```

### Available methods

[](#available-methods)

- `to($phoneNumber)` : `(string)` Receiver phone number. Using international phone number (+62XXXXXXXXXX) format is highly suggested.
- `content($message)` : `(string)` The SMS content. If content length is more than 160 characters, it will be sent as [long SMS](https://en.wikipedia.org/wiki/Concatenated_SMS) automatically.
- `sender($sender)` : `(string)` Phone sender ID set in Gammu `phones` table. This method is only available if you're using native Gammu method.
- `callback($callbackText)` : `(string)` Callback text for [Gammu Api](https://github.com/kristiandrucker/gammuApi) gives you function to pass text and when the Api will send your message it will be sent back to your callback url specified in your Gammu Api. Please setup callback properly on your Gammu Api.
- `channel($redisChannelName)` : `(string)` Channel to publish to Redis. Default channel is `gammu-channel`.

Changelog
---------

[](#changelog)

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

Testing
-------

[](#testing)

```
$ composer test
```

Security
--------

[](#security)

If you discover any security related issues, please email  or  instead of using the issue tracker.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Muhammad Zamroni](https://github.com/matriphe)
- [Kristian Drucker](https://github.com/kristiandrucker)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/920d39b6e68de47800457890effd4fe00b6f285bdcc70a9421e6b919f21dfd85?d=identicon)[purwadipw](/maintainers/purwadipw)

---

Top Contributors

[![PurwadiPw](https://avatars.githubusercontent.com/u/12653916?v=4)](https://github.com/PurwadiPw "PurwadiPw (3 commits)")

### Embed Badge

![Health badge](/badges/pw-laragammu/health.svg)

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

###  Alternatives

[tijsverkoyen/css-to-inline-styles

CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.

5.8k505.3M227](/packages/tijsverkoyen-css-to-inline-styles)[minishlink/web-push

Web Push library for PHP

1.9k12.0M53](/packages/minishlink-web-push)[laravel-notification-channels/twilio

Provides Twilio notification channel for Laravel

2587.7M12](/packages/laravel-notification-channels-twilio)[spatie/url-signer

Generate a url with an expiration date and signature to prevent unauthorized access

4422.3M16](/packages/spatie-url-signer)[mattketmo/email-checker

Throwaway email detection library

2742.0M5](/packages/mattketmo-email-checker)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)

PHPackages © 2026

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