PHPackages                             saleemepoch/txtnation - 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. [Payment Processing](/categories/payments)
4. /
5. saleemepoch/txtnation

ActiveLibrary[Payment Processing](/categories/payments)

saleemepoch/txtnation
=====================

A Laravel library to help send free and premium SMS via txtNation. Forked from Marc O'Leary's txtNation Gateway

v1.0(10y ago)1147MITPHP &gt;=5.3.0

Since May 28Compare

[ Source](https://github.com/saleemepoch/txtNation)[ Packagist](https://packagist.org/packages/saleemepoch/txtnation)[ RSS](/packages/saleemepoch-txtnation/feed)WikiDiscussions Synced yesterday

READMEChangelog (1)Dependencies (6)Versions (2)Used By (0)

Laravel package for txtNation Gateway
=====================================

[](#laravel-package-for-txtnation-gateway)

The txtNation Gateway PHP Library works with Laravel 5+. It is an extension of Marc O'Leary's txtnation/txtnation-gateway-php.

- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
    - \[Free SMS\] (#free-sms)
    - \[Premium SMS\] (#premium-sms)
- [Support](#support)

Prerequisites
-------------

[](#prerequisites)

This README assumes you are using the following PHP extensions:

- php-curl
- php-mbstring

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

[](#installation)

- Use following command to install:

```
composer require saleemepoch/txtnation

```

- Add the service provider to your $providers array in config/app.php file like:

```
'saleemepoch\txtNation\Providers\txtNationServiceProvider' // Laravel 5

```

```
saleemepoch\txtNation\Providers\txtNationServiceProvider::class // Laravel 5.1 or greater

```

- Run the following command to publish configuration:

```
php artisan vendor:publish

```

Configuration
-------------

[](#configuration)

- After installation, you will need to add your txtNation settings. Following is the code you will find in **config/txtNation.php**, which you should update accordingly.

```
return [
	/* REQUIRED */
	'username' => '',
	'ekey' => '',
	// also known as sender id.
	'title' => '',

	/* OPTIONAL */
	// if set, requests to txtNation will also consists of the supplied shortcode
	'shortcode' => '',

	// required only if sending MT to Bill based on texted keywords
	'keywords' => [
		/*
		 * keywords and their corresponding amounts.
		 *
		 * This will set the value when billing the customer based on the keyword texted by the user
		 *
		 *
		'BILL10' => 10.00,
		'BILL5' => 5.00,
		*/
		'BILL1' => 1.00
	]
];

```

Usage
-----

[](#usage)

- To send a free SMS

```
$message = new SMSMessage;
$result = $message->msisdn('447459831491')->body('Please reply to this message with keyword PENNY!')->senderId('784645')->send();

if ($result->success()){
    dd('Message sent!');
} else {
    dd('Error sending message! Code: ' . $result->getErrorCode() . ' (' . $result->getErrorMessage() . ')');
}

```

- MT to Bill a user after opting-in

1. Make sure in config/txtNation.php you have keywords mapped to values the user is to be charged, e.g.

```
'keywords' => [
		'BILL10' => 10.00,
		'BILL5' => 5.00,
		'BILL1' => 1.00
	]

```

2. Login to your txtNation account -&gt; APIs -&gt; Gateway and set your responder URL, e.g.
3. Setup a route in your routes.php:

```
Route::post('txtNationResponse', 'txtNationController@response');

```

4. Exclude this route from CSRF protection by adding the URI to the $except property of the VerifyCsrfToken middleware:

```
protected $except = [
        'txtNationResponse',
    ];

```

5. Setup a controller like txtNationController for this example and create a method:

```
public function response(Request $request) {

    if ($request->action == 'mpush_ir_message' &&
        (isset($request->billing) && $request->billing == 'MT')) {

        $keywords = config('txtNation.keywords');

        $message = new SMSMessage;
        $result = $message->msisdn($request->number)
        ->reply(1)
        ->body('Thank you for your business')
        ->id($request->id)
        ->network($request->network)
        ->currency('GBP')
        ->value($keywords[$request->message])
        ->send();

    }

}

```

The above controller method will accept the response from txtNation and if billing is set to MT it will reply back charging the user.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity58

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

3687d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7266213?v=4)[Saleem Beg](/maintainers/saleemepoch)[@saleemepoch](https://github.com/saleemepoch)

---

Top Contributors

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

---

Tags

laravelbillingphonesmsmobiletextCelltxtNation

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/saleemepoch-txtnation/health.svg)

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

###  Alternatives

[laravel/framework

The Laravel Framework.

34.8k543.8M19.6k](/packages/laravel-framework)[craftcms/cms

Craft CMS

3.6k3.6M3.0k](/packages/craftcms-cms)[google/cloud

Google Cloud Client Library

1.2k16.7M57](/packages/google-cloud)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[messagecloud/gateway-php

A PHP library to help you integrate the MessageCloud Gateway.

137.2k](/packages/messagecloud-gateway-php)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k13](/packages/tempest-framework)

PHPackages © 2026

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