PHPackages                             thinkstudeo/laravel-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. [API Development](/categories/api)
4. /
5. thinkstudeo/laravel-textlocal

ActiveLibrary[API Development](/categories/api)

thinkstudeo/laravel-textlocal
=============================

A Laravel wrapper for Textlocal API

1.0.0(7y ago)059MITPHPPHP &gt;=7.0

Since Apr 22Pushed 7y agoCompare

[ Source](https://github.com/thinkstudeo/laravel-textlocal)[ Packagist](https://packagist.org/packages/thinkstudeo/laravel-textlocal)[ Docs](https://github.com/thinkstudeo/laravel-textlocal)[ RSS](/packages/thinkstudeo-laravel-textlocal/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (6)Versions (2)Used By (0)

Laravel Wrapper for [Textlocal](http://textlocal.in) API.
=========================================================

[](#laravel-wrapper-for-textlocal-api)

[![Latest Version on Packagist](https://camo.githubusercontent.com/9f10009d1daab52219423eb2b436edd60cc32a347604338d194b470d98a4a75f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7468696e6b73747564656f2f6c61726176656c2d746578746c6f63616c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/thinkstudeo/laravel-textlocal)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/51449d2bf05a880b3a352ca3778e70fcfcbb479414f6bcc9dd52a5d7e1865bf5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7468696e6b73747564656f2f6c61726176656c2d746578746c6f63616c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/thinkstudeo/laravel-textlocal)

A convenience wrapper for the textlocal.in api requests for transactional as well as promotional accounts. The reseller account specific api are not available at this point in time.

Sms messaging can be used for transactional messages like:

- Sending OTP for Two Factor Authentication
- Confirmation of payment received or order placed etc

Transactional messages need to be sent through at any time without any DND (Do Not Disturb) restrictions. For this one needs to register a Transactional Account with Textlocal or request for conversion of the default account to a Transactional Account.

On the other hand Sms messaging may also be used for promotional activities like:

- Announcing product launch or discount sale
- Announcing an award receid=ved by the company or product
- Sending coupon code etc

Promotional messages need to adhere to the DND (Do Not Disturb) restrictions. The default signup at Textlocal creates a Promotional Account by default.

Contents
--------

[](#contents)

- [Laravel Wrapper for Textlocal API.](#laravel-wrapper-for-textlocal-api)
    - [Contents](#contents)
    - [Installation](#installation)
    - [Usage](#usage)
        - [Transactional Account](#transactional-account)
        - [Available Message methods](#available-message-methods)
    - [Changelog](#changelog)
    - [Testing](#testing)
    - [Security](#security)
    - [Contributing](#contributing)
    - [Credits](#credits)
    - [License](#license)

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

[](#installation)

```
$ composer require thinkstudeo/textlocal
```

Config
------

[](#config)

Package facilitates using Transactional as well as Promotional Account with Textlocal at the same time.

Add the following to your `config/services.php` file

```
'textlocal' => [
    'transactional' => [
		'apiKey' => env('TEXTLOCAL_TRANSACTIONAL_KEY')
    ],
    'promotional' => [
        'apiKey' => env('TEXTLOCAL_PROMOTIONAL_KEY')
    ]
]
```

Don't forget to add the keys to your `.env` file

If you have just one - i.e. Promotional Account or Transactional Account - make sure to enter the API key accordingly. For example, for just a Textlocal Promotional Account, declare `TEXTLOCAL_PROMOTIONAL_KEY=api_key_for_your_promotional_account`.

```
TEXTLOCAL_TRANSACTIONAL_KEY=
TEXTLOCAL_PROMOTIONAL_KEY=

```

Usage
-----

[](#usage)

There are two facades included with the package:

- `Sms` for sending messages
- `Account` for interacting with the Textlocal Account

For differentiating the api calls with respect to account type use `transactional()` or `promotional()` to set the account for the api call.

### Messaging - Transactional Account

[](#messaging---transactional-account)

You must have a transactional account with Textlocal inorder to send transactional sms without DND restriction 24x7. Also don't forget to get your templates for the transactional messages approved by Textlocal. Finally, you must generate an API KEY from your Textlocal dashboard [![API KEY](/docs/api_key.png)](/docs/api_key.png)

Then you can use the facade like

### To send to a single user

[](#to-send-to-a-single-user)

```
Sms::transactional()
    ->to('911234523451')
    ->from('SENDER')   //Your registered sender
    ->send('My message');  //as per your approved template
```

### To send to multiple users at once

[](#to-send-to-multiple-users-at-once)

```
Sms::transactional()
    ->to('911234523451,919898456456')
    ->from('SENDER')   //Your registered sender
    ->send('My message');  //as per your approved template
```

OR, you can also provide the numbers as an array

```
Sms::transactional()
    ->to(['911234523451', '919898456456'])
    ->from('SENDER')   //Your registered sender
    ->send('My message');  //as per your approved template
```

And if you want to schedule a message to be sent at a specified time in future you can provide a datetime string in any of the formats supported by [Carbon](https://carbon.nesbot.com/)or you may also provide a unix timestamp.

```
$schedule = "2019-01-01 09:30:00";

Sms::transactional()
    ->to('911234523451,919898456456')
    ->at($schedule)
    ->from('SENDER')   //Your registered sender
    ->send('My message');  //as per your approved template
```

To cancel a scheduled message

```
//Get a list of all the scheduled messages
$response = Account::transactional()->scheduledMessages();
$scheduledMessages = $response->scheduled;

//Identify the scheduled message you want to cancel
$msg = $scheduledMessages[0];

//Cancel the message
Account::transactional()->cancel($msg->id);
```

### Messaging - Promotional Account

[](#messaging---promotional-account)

### To send to a single user

[](#to-send-to-a-single-user-1)

```
Sms::promotional()
    ->to('911234523451')
    ->from('TXTLCL')   //or Your registered sender
    ->send('My message');
```

### To send to multiple users at once

[](#to-send-to-multiple-users-at-once-1)

```
Sms::promotional()
    ->to('911234523451,919898456456')
    ->from('TXTLCL')   //or Your registered sender
    ->send('My message');
```

OR, you can also provide the numbers as an array

```
Sms::promotional()
    ->to(['911234523451', '919898456456'])
    ->from('TXTLCL')   //or Your registered sender
    ->send('My message');
```

And if you want to schedule a message to be sent at a specified time in future you can provide a datetime string in any of the formats supported by [Carbon](https://carbon.nesbot.com/)or you may also provide a unix timestamp.

```
$schedule = "2019-01-01 09:30:00";

Sms::promotional()
    ->to('911234523451,919898456456')
    ->at($schedule) //unix timestamp
    ->from('TXTLCL')   //or Your registered sender
    ->send('My message');  //as per your approved template
```

To cancel a scheduled message

```
//Get a list of all the scheduled messages
$response = Account::promotional()->scheduledMessages();
$scheduledMessages = $response->scheduled;

//Identify the scheduled message you want to cancel
$msg = $scheduledMessages[0];

//Cancel the message
Account::promotional()->cancel($msg->id);
```

### Message Status

[](#message-status)

To get the details of status of a message sent

```
//Capture the message id and or batch id when you send the message
$response = Sms::promotional()->to(['911234523451', '919898456456'])->from('TXTLCL')->send('My Message');
$msgId = $response->messages[1]->id;
$batchId = $response->batch_id;

//Get the status
Account::promotional()->messageStatus($msgId);
//Or
Account::promotional()->batchStatus($batchId);
```

### Received Messages from Inbox

[](#received-messages-from-inbox)

To retrieve the received messages from specific inbox

```
//Get a list of all inboxes in your account
$inboxList = Account::promotional()->inboxes();

//Identify the inbox you want to fetch the messages from, and get its id
$inboxId = $inboxList[0]->id;

//Fetch the messages from the inbox
$messages = Account::promotional()->messages($inboxId);
```

### Templates in Account

[](#templates-in-account)

To fetch all the templates associated with the account

```
$templates = Account::transactional()->templates();
```

### Sender names

[](#sender-names)

To fetch all the approved sender names from your account

```
$senders = Account::transactional()->senders();
```

### Account Balance

[](#account-balance)

To get the current account balance (credits remaining)

```
$balance = Account::promotional()->balance();
```

### Check the availability of keyword

[](#check-the-availability-of-keyword)

```
$availability = Account::promotional()->checkKeyword('KEYWRD');
```

### Check if a Contact Group exists

[](#check-if-a-contact-group-exists)

```
$exists = Account::promotional()->groupExists('Customers')
```

### Create a New Contact Group

[](#create-a-new-contact-group)

```
$groupId = Account::promotional()->createGroup('Tech')->group->id;
```

### Get a list of all Groups

[](#get-a-list-of-all-groups)

```
$groupList = Account::promotional()->groups();
```

### Delete a Contact Group

[](#delete-a-contact-group)

```
//Note the id of the group when you create a new one
$customersId = Account::promotional()->createGroup('Customers')->group->id;
//Or get a list of all groups
$groupList = Account::promotional()->groups();
//Get the id of the group you want to delete
$groupId = $groupList[0]->id;

//Delete the group
$status = Account::promotional()->deleteGroup($customerId);
//Or
$status = Account::promotional()->deleteGroup($groupId);
//Or just give the name of the group to the command
$status = Account::promotional()->deleteGroup('Customers');
```

### List of all Members of a Contact Group

[](#list-of-all-members-of-a-contact-group)

```
$groupId = '66455';
$members = Account::promotional()->members($groupId);
```

### Add numbers to an existing contact group

[](#add-numbers-to-an-existing-contact-group)

```
$groupId = '66455';
$numbers = '919033100026,919879612326';
$response = Account::promotional()->addNumbers($numbers, $groupId);
```

### Add Contacts to an existing group

[](#add-contacts-to-an-existing-group)

```
$groupId = '66455';

$members = [
	['number' => '911234567894', 'first_name' => 'John', 'last_name' => 'Doe'],
	['number' => '913355667798', 'first_name' => 'Jane', 'last_name' => 'Mclane']
];

$response = Account::promotional()->addMembers($members);
```

### Remove a contact from the group

[](#remove-a-contact-from-the-group)

```
$response = Account::promotional()->removeMember('913355667798', $groupId);
```

### Get a list of all who have opted out

[](#get-a-list-of-all-who-have-opted-out)

```
$response = Account::promotional()->optOuts();
```

### History

[](#history)

```
//Single message histr=ory
$response = Account::promotional()->history('single');

//Group message history
$response = Account::promotional()->history('group');

//Api message history
$response = Account::promotional()->history('api');
```

### Surveys

[](#surveys)

To fetch a list of all active surveys

```
$response = Account::promotional()->surveys();
```

To get the details of a specific survey

```
//Get a list of active surveys
$surveys = Account::promotional()->surveys();
//Identify the survey for which you want the details
$surveyId = $surveys->survey_ids[0]->id;
//Fetch the details
$response = Account::promotional()->surveyDetails($surveyId);
```

To get the results of a specific survey

```
//Get a list of active surveys
$surveys = Account::promotional()->surveys();
//Identify the survey for which you want the results
$surveyId = $surveys->survey_ids[0]->id;
//Fetch the results
$response = Account::promotional()->surveyResults($surveyId);
```

Changelog
---------

[](#changelog)

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

Testing
-------

[](#testing)

Please note that all test are integration tests meaning they will actually hit the textlocal api and consume the credits.

```
$ composer test
```

Security
--------

[](#security)

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

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

[](#contributing)

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

Credits
-------

[](#credits)

- [Neerav Pandya](https://github.com/neeravp)

License
-------

[](#license)

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

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2579d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

laraveltextlocal

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/thinkstudeo-laravel-textlocal/health.svg)

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

###  Alternatives

[irazasyed/telegram-bot-sdk

The Unofficial Telegram Bot API PHP SDK

3.3k4.5M84](/packages/irazasyed-telegram-bot-sdk)[dcblogdev/laravel-microsoft-graph

A Laravel Microsoft Graph API (Office365) package

168285.5k1](/packages/dcblogdev-laravel-microsoft-graph)[vluzrmos/slack-api

Wrapper for Slack.com WEB API.

102589.1k3](/packages/vluzrmos-slack-api)[tzsk/sms

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

320244.3k6](/packages/tzsk-sms)[smodav/mpesa

M-Pesa API implementation

16363.7k1](/packages/smodav-mpesa)[dcblogdev/laravel-xero

A Laravel Xero package

53129.1k1](/packages/dcblogdev-laravel-xero)

PHPackages © 2026

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