PHPackages                             msonowal/laravel-notification-channel-textlocal - 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. msonowal/laravel-notification-channel-textlocal

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

msonowal/laravel-notification-channel-textlocal
===============================================

Textlocal Notifications Channel for Laravel

v2.7.0(2y ago)528.7k↓50%8MITPHPPHP &gt;=7.0CI failing

Since Nov 25Pushed 2y ago1 watchersCompare

[ Source](https://github.com/msonowal/laravel-notification-channel-textlocal)[ Packagist](https://packagist.org/packages/msonowal/laravel-notification-channel-textlocal)[ Docs](https://github.com/laravel-notification-channels/textlocal)[ RSS](/packages/msonowal-laravel-notification-channel-textlocal/feed)WikiDiscussions master Synced 1mo ago

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

This package allows to send SMS using Textlocal API using laravel notifications channel textlocal sms

Supports Laravel 5.5 upto 10.x

[![Latest Stable Version](https://camo.githubusercontent.com/4cb9b008a8a28d14099d4d105e8587613938ded6bba03a3ab53360b7cb614fc9/68747470733a2f2f706f7365722e707567782e6f72672f6d736f6e6f77616c2f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c2d746578746c6f63616c2f762f737461626c65)](https://packagist.org/packages/msonowal/laravel-notification-channel-textlocal)[![License](https://camo.githubusercontent.com/1e7e1635d4efc0049684e5d133a6470b4efa07c81cab41f344ca8249851c4ab2/68747470733a2f2f706f7365722e707567782e6f72672f6d736f6e6f77616c2f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c2d746578746c6f63616c2f6c6963656e7365)](https://packagist.org/packages/msonowal/laravel-notification-channel-textlocal)[![Total Downloads](https://camo.githubusercontent.com/3e626bdaa822f1928e388c538e341081d9c7f2f1068e4b13552f4ed66a4e2ecb/68747470733a2f2f706f7365722e707567782e6f72672f6d736f6e6f77616c2f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c2d746578746c6f63616c2f646f776e6c6f616473)](https://packagist.org/packages/msonowal/laravel-notification-channel-textlocal)

This package makes it easy to send notifications using [textlocal](https://www.textlocal.in/) with Laravel 5.3.+

To use version ^2.3.0 onwards will require PHP 8.0

for other PHP version use upto ^2.2.0

Contents
--------

[](#contents)

- [Installation](#installation)
    - [Setting up the textlocal service](#setting-up-the-textlocal-service)
- [Usage](#usage)
    - [Available Message methods](#available-message-methods)
- [Changelog](#changelog)
- [Testing](#testing)
- [Security](#security)
- [Contributing](#contributing)
- [Credits](#credits)
- [License](#license)

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

[](#installation)

Create an account in textlocal then create an API key or hash(password).

`composer require msonowal/laravel-notification-channel-textlocal`

### Setting up the textlocal service

[](#setting-up-the-textlocal-service)

default config `textlocal.php` update where desired

Important Either specify a Key OR a Hash - don't enter both!

```
return [
	'username'  => env('TEXTLOCAL_USERNAME'),
	'password'  => env('TEXTLOCAL_PASSWORD'),
	'hash'      => env('TEXTLOCAL_HASH'),  //optional if api_key is set
	'api_key'   => env('TEXTLOCAL_API_KEY'), //optional if hash is set
	'sender'    => env('TEXTLOCAL_SENDER'),
	'request_urls' => [
		'IN' => 'https://api.textlocal.in/',
		'UK' => 'https://api.txtlocal.com/'
	],
	'country'   => env('TEXTLOCAL_COUNTRY', 'IN'),
    'extra' => [
        // extra config define keys as desired for use within the textlocal client config
        // if you want to use the custom client config for each notification or notifiable
        // INotificationUsesTextlocalClientConfig
    ]public function getSenderId($notifiable)
### Configuring .env

```

```
TEXTLOCAL_USERNAME=Your email id or api key
TEXTLOCAL_HASH=get it from url '/docs/' under your API KEYS section
TEXTLOCAL_API_KEY get it from url '/docs/' under your API KEYS section
TEXTLOCAL_SENDER=Name of the Sender that will be displayed to the recipient (max 6 Characters).
TEXTLOCAL_COUNTRY=Your Two letter(ISO-3166-alpha-2) Country Code. It should be the Country of the TEXTLOCAL account. defaults to IN

```

```

### Publish Config

```

```
php artisan vendor:publish --tag=textlocal

```

```

Currently, only textlocal of two country is supported IN(India) and UK(United Kingdom).

## Usage

Implement this method `routeNotificationForTextlocal()` in your notifiable class/model which will return array of mobile numbers. Please make sure the mobile number contains the dial code as well (e.g +91 for India). And lastly implement `toSms()` method in the notification class which will return the (string) sms or template that is defined in textlocal account that needs to be send.

## Usage

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

```php
use Illuminate\Notifications\Notification;
use NotificationChannels\Textlocal\TextlocalChannel;

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

    public function toSms($notifiable)
    {
        return 'Use 1234 as OTP for resetting your password.';
    }
}

```

In your notifiable model, make sure to include a `routeNotificationForTextlocal()` method, which returns a phone number or multiple numbers in array or an array of phone numbers.

```
public function routeNotificationForTextlocal(): array
{
    return [$this->mobile_no];
}
```

Annoynmous Notifable when say mobile no is not added to a notifiable model you can directly send to mobile no by using that

```
Notification::route('Textlocal', $mobileNo')->notify(new VerifyMobileNotification($otp));
```

### Available Message methods

[](#available-message-methods)

And if you want to have a specific sender based on Notification, e.g. like you are sending promotional notification using one and another for transaction then you can just define this method in your notification class which will return your sender id for that notification only

```
public function getSenderId($notifiable)
{
     return 'YOUR_SENDER_ID';
}

```

Unicode support If you want to send the notification content to have unicode support. Define this method in your notification which will return boolean based on which the sms will set the unicode mode in textlocal API

```
public function getUnicodeMode()
{
     return true;
}

```

A list of all available options

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  instead of using the issue tracker.

Found any bugs or improvement open an issue or send me a PR
===========================================================

[](#found-any-bugs-or-improvement-open-an-issue-or-send-me-a-pr)

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

[](#contributing)

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

Credits
-------

[](#credits)

- [Manash Jyoti Sonowal](https://github.com/msonowal)
- [Mr Ejang](https://github.com/tomonsoejang)
- [Sinadh](https://github.com/tsainadh)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

TODO
----

[](#todo)

Need to convert to Guzzle Http as a Client in core Add more countries add tests

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 86.6% 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 ~124 days

Recently: every ~158 days

Total

20

Last Release

738d ago

Major Versions

v1.0.9 → v2.0.02019-10-30

PHP version history (2 changes)v1.0.0PHP &gt;=5.6.4

v2.0.0PHP &gt;=7.0

### Community

Maintainers

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

---

Top Contributors

[![msonowal](https://avatars.githubusercontent.com/u/6334484?v=4)](https://github.com/msonowal "msonowal (58 commits)")[![mpociot](https://avatars.githubusercontent.com/u/804684?v=4)](https://github.com/mpociot "mpociot (2 commits)")[![lrljoe](https://avatars.githubusercontent.com/u/104938042?v=4)](https://github.com/lrljoe "lrljoe (1 commits)")[![nikugogoi](https://avatars.githubusercontent.com/u/20663182?v=4)](https://github.com/nikugogoi "nikugogoi (1 commits)")[![rupamjbordoloi](https://avatars.githubusercontent.com/u/30255913?v=4)](https://github.com/rupamjbordoloi "rupamjbordoloi (1 commits)")[![ShankarAkunuri](https://avatars.githubusercontent.com/u/18738172?v=4)](https://github.com/ShankarAkunuri "ShankarAkunuri (1 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (1 commits)")[![tsainadh](https://avatars.githubusercontent.com/u/56969292?v=4)](https://github.com/tsainadh "tsainadh (1 commits)")[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (1 commits)")

---

Tags

laravellaravel-notification-channelslaravel-packagesmstextlocal

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/msonowal-laravel-notification-channel-textlocal/health.svg)

```
[![Health](https://phpackages.com/badges/msonowal-laravel-notification-channel-textlocal/health.svg)](https://phpackages.com/packages/msonowal-laravel-notification-channel-textlocal)
```

###  Alternatives

[laravel-notification-channels/telegram

Telegram Notifications Channel for Laravel

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

Web Push Notifications driver for Laravel.

7984.5M16](/packages/laravel-notification-channels-webpush)[laravel-notification-channels/fcm

FCM (Firebase Cloud Messaging) Notifications Driver for Laravel

5917.0M16](/packages/laravel-notification-channels-fcm)[s-ichikawa/laravel-sendgrid-driver

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

4139.3M1](/packages/s-ichikawa-laravel-sendgrid-driver)[laravel-notification-channels/twilio

Provides Twilio notification channel for Laravel

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

Apple APN Push Notification Channel

2021.9M4](/packages/laravel-notification-channels-apn)

PHPackages © 2026

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