PHPackages                             tzsk/sms - 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. tzsk/sms

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

tzsk/sms
========

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

10.0.0(3mo ago)319270.8k↓19.9%80[16 PRs](https://github.com/tzsk/sms/pulls)6MITPHPPHP ^8.4CI passing

Since Dec 18Pushed 1w ago8 watchersCompare

[ Source](https://github.com/tzsk/sms)[ Packagist](https://packagist.org/packages/tzsk/sms)[ Docs](https://github.com/tzsk/sms)[ Fund](https://paypal.me/KMAhmed)[ GitHub Sponsors](https://github.com/tzsk)[ RSS](/packages/tzsk-sms/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (10)Dependencies (34)Versions (71)Used By (6)

🎁 Laravel SMS Gateway
=====================

[](#gift-laravel-sms-gateway)

[![SMS Cover](resources/sms.png)](resources/sms.png)

[![GitHub License](https://camo.githubusercontent.com/4427c7d234fa1e5d6b8725e4983fcb6657194b8f519bfea7284cd737f9692258/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f747a736b2f736d733f7374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/4427c7d234fa1e5d6b8725e4983fcb6657194b8f519bfea7284cd737f9692258/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f747a736b2f736d733f7374796c653d666f722d7468652d6261646765)[![Latest Version on Packagist](https://camo.githubusercontent.com/12f007d8c19207c2e07e6ac000c0dc314e9626bd1df1ca53ddaeebe46d38f3e1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f747a736b2f736d732e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d636f6d706f736572)](https://packagist.org/packages/tzsk/sms)[![GitHub Tests Action Status](https://camo.githubusercontent.com/6041a1672af3e476c917723f4ee85d02a7f8eb422f1d8733ab5ad1c39a533d4e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f747a736b2f736d732f74657374732e796d6c3f6272616e63683d6d6173746572266c6162656c3d7465737473267374796c653d666f722d7468652d6261646765266c6f676f3d676974687562)](https://github.com/tzsk/sms/actions?query=workflow%3ATests+branch%3Amaster)[![Total Downloads](https://camo.githubusercontent.com/632075d44b9a3de7552d88c0f7615763b1500f9f6b9a661e4b9a701ec4d0dc90/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f747a736b2f736d732e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d6c61726176656c)](https://packagist.org/packages/tzsk/sms)

This is a Laravel Package for SMS Gateway Integration. Now sending SMS is easy and reliable.

List of supported gateways:

- [AWS SNS](https://aws.amazon.com/sns/)
- [Textlocal](http://textlocal.in)
- [Twilio](https://www.twilio.com)
- [Clockwork](https://www.clockworksms.com/)
- [LINK Mobility](https://www.linkmobility.com)
- [Kavenegar](https://kavenegar.com)
- [Melipayamak](https://www.melipayamak.com)
- [Melipayamakpattern](https://www.melipayamak.com)
- [Smsir](https://www.sms.ir)
- [Tsms](http://www.tsms.ir)
- [Farazsms](https://farazsms.com)
- [Farazsmspattern](https://farazsms.com)
- [SMS Gateway Me](https://smsgateway.me)
- [SmsGateWay24](https://smsgateway24.com/en)
- [Ghasedak](https://ghasedaksms.com/)
- [Sms77](https://www.sms77.io)
- [SabaPayamak](https://sabapayamak.com)
- [LSim](https://sendsms.az/)
- [Rahyabcp](https://rahyabcp.ir/)
- [Rahyabir](https://sms.rahyab.ir/)
- [D7networks](https://d7networks.com/)
- [Hamyarsms](https://hamyarsms.com/)
- [SMSApi](https://www.smsapi.si/)
- Others are under way.

📦 Install
---------

[](#package-install)

Via Composer

```
$ composer require tzsk/sms
```

⚡ Configure
-----------

[](#zap-configure)

Publish the configuration file:

```
$ php artisan sms:publish
```

In the configuration file, you can set the default driver to use for sending your SMS messages. However, you can also seamlessly change the driver at runtime.

Choose the gateway you would like to use for your application. Then, set it as the default driver so that you do not have to specify it every time. You can also configure and use multiple gateways within the same project.

```
// Eg. if you want to use SNS.
'default' => 'sns',
```

Then fill the credentials for that gateway in the drivers array.

```
// Eg. for SNS.
'drivers' => [
    'sns' => [
        // Fill all the credentials here.
        'key' => 'Your AWS SNS Access Key',
        'secret' => 'Your AWS SNS Secret Key',
        'region' => 'Your AWS SNS Region',
        'from' => 'Your AWS SNS Sender ID', //sender
        'type' => 'Tansactional', // Or: 'Promotional'
    ],
    ...
]
```

#### Textlocal Configuration:

[](#textlocal-configuration)

Textlocal is added by default. You simply need to update the credentials in the `textlocal` driver section.

#### AWS SNS Configuration:

[](#aws-sns-configuration)

If you want to use AWS SNS, you must install the required composer library first:

```
composer require aws/aws-sdk-php
```

#### Clockwork Configuration:

[](#clockwork-configuration)

If you want to use Clockwork, you must install the required composer library first:

```
composer require mediaburst/clockworksms
```

#### Twilio Configuration:

[](#twilio-configuration)

If you want to use Twilio, you must install the required composer library first:

```
composer require twilio/sdk
```

Then, simply update the credentials in the `twilio` driver section.

#### Melipayamak or Melipayamakpattern Configuration:

[](#melipayamak-or-melipayamakpattern-configuration)

If you want to use Melipayamak or Melipayamakpattern, you must install the required composer library first:

```
composer require melipayamak/php
```

#### Kavenegar Configuration:

[](#kavenegar-configuration)

If you want to use Kavenegar, you must install the required composer library first:

```
composer require kavenegar/php
```

#### SMS Gateway Me Configuration:

[](#sms-gateway-me-configuration)

If you want to use SMS Gateway Me, you must install the required composer library first:

```
composer require smsgatewayme/client
```

🔥 Usage
-------

[](#fire-usage)

You can easily send SMS messages in your application code like this:

```
# On the top of the file.
use Tzsk\Sms\Facades\Sms;

////

# In your Controller.
Sms::send("this message", function($sms) {
    $sms->to(['Number 1', 'Number 2']); # The numbers to send to.
});
# OR...
Sms::send("this message")->to(['Number 1', 'Number 2'])->dispatch();

# If you want to use a different driver.
Sms::via('gateway')->send("this message", function($sms) {
    $sms->to(['Number 1', 'Number 2']);
});
# OR...
Sms::via('gateway')->send("this message")->to(['Number 1', 'Number 2'])->dispatch();

# Here gateway is explicit : 'twilio' or 'textlocal' or any other driver in the config.
# The numbers can be a single string as well.

# If you are not a Laravel's facade fan, you can use sms helper:

sms()->send("this message", function($sms) {
    $sms->to(['Number 1', 'Number 2']); # The numbers to send to.
});

sms()->send("this message")->to(['Number 1', 'Number 2'])->dispatch();

sms()->via('gateway')->send("this message", function($sms) {
    $sms->to(['Number 1', 'Number 2']);
});

sms()->via('gateway')->send("this message")->to(['Number 1', 'Number 2'])->dispatch();

# Change the from|sender|sim value with from() option:

sms()->via('gateway')->send("this message")->from('Your From Number | Sender Value | Sim Value ')->to(['Number 1', 'Number 2'])->dispatch();

# Sending argument and pattern code in pattern drivers such as melipayamakpattern and farazsmspattern.

#Note: The first argument is always known as the pattern code.

sms()->via('melipayamakpattern')->send("patterncode=123 \n arg1=name \n arg2=family")->to(['Number 1', 'Number 2'])->dispatch();
```

### Runtime Configuration

[](#runtime-configuration)

You can override the default gateway configuration at runtime:

```
# Override configuration for this specific SMS
Sms::via('gateway')
    ->config(['from' => 'CUSTOM-SENDER'])
    ->send('this message')
    ->to(['Number1', 'Number2'])
    ->dispatch();
```

😍 Channel Usage
---------------

[](#heart_eyes-channel-usage)

First, you need to create your notification using the `php artisan make:notification` command. Then, the `SmsChannel::class` can be used as a notification channel like below:

```
namespace App\Notifications;

use Tzsk\Sms\Builder;
use Illuminate\Bus\Queueable;
use Tzsk\Sms\Channels\SmsChannel;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;

class InvoicePaid extends Notification implements ShouldQueue
{
    use Queueable;

    /**
     * Get the notification channels.
     *
     * @param  mixed  $notifiable
     * @return array|string
     */
    public function via($notifiable)
    {
        return [SmsChannel::class];
    }

    /**
     * Get the recipients and body of the notification.
     *
     * @param  mixed  $notifiable
     * @return Builder
     */
    public function toSms($notifiable)
    {
        return (new Builder)->via('gateway') # via() is Optional
            ->send('this message')
            ->to('some number');
    }
}
```

> **Tip:** You can use the same Builder Instance in the send method.

```
$builder = (new Builder)->via('gateway') # via() is Optional
    ->send('this message')
    ->to('some number');

Sms::send($builder);

# OR...
$builder = (new Builder)->send('this message')
    ->to(['some number']);

Sms::via('gateway')->send($builder);
```

#### Custom Made Driver, How To:

[](#custom-made-driver-how-to)

First, you must define the name of your driver in the drivers array and specify any configuration parameters you need.

```
'drivers' => [
    'textlocal' => [...],
    'twilio' => [...],
    'my_driver' => [
        ... # Your Config Params here.
    ]
]
```

Next, you need to create a Driver Map Class that will be used to handle sending the SMS. Your driver class simply needs to extend `Tzsk\Sms\Contracts\Driver`.

For example, if you created a class: `App\Packages\SMSDriver\MyDriver`.

```
namespace App\Packages\SMSDriver;

use Tzsk\Sms\Contracts\Driver;

class MyDriver extends Driver
{
    /**
    * You Should implement these methods:
    *
    * 1. boot() -> (optional) Initialize any variable or configuration that you need.
    * 2. send() -> Main method to send messages.
    *
    * Note: settings array will be automatically assigned in Driver class' constructor.
    *
    * Example Given below:
    */

    /**
    * @var mixed
    */
    protected $client;

    protected function boot() : void
    {
        $this->client = new Client(); # Guzzle Client for example.
    }

    /**
    * @return object Ex.: (object) ['status' => true, 'data' => 'Client Response Data'];
    */
    public function send()
    {
        $this->recipients; # Array of Recipients.
        $this->body; # SMS Body.

        # Main logic of Sending SMS.
        ...
    }

}
```

Once you create this class, you must specify it in the `sms.php` configuration file under the `map` section.

```
'map' => [
    ...
    'my_driver' => App\Packages\SMSDriver\MyDriver::class,
]
```

**Note:-** Ensure that the key of the `map` array is exactly identical to the key of the `drivers` array.

🔬 Testing
---------

[](#microscope-testing)

```
composer test
```

📅 Changelog
-----------

[](#date-changelog)

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

❤️ Contributing
---------------

[](#heart-contributing)

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

🔒 Security Vulnerabilities
--------------------------

[](#lock-security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

👑 Credits
---------

[](#crown-credits)

- [Kazi Ahmed](https://github.com/tzsk)
- [All Contributors](../../contributors)

👮‍♂️ License
------------

[](#policeman-license)

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

###  Health Score

73

—

ExcellentBetter than 100% of packages

Maintenance90

Actively maintained with recent releases

Popularity55

Moderate usage in the ecosystem

Community36

Small or concentrated contributor base

Maturity95

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~116 days

Recently: every ~282 days

Total

30

Last Release

103d ago

Major Versions

5.4.1 → 6.0.02022-04-02

6.0.1 → 7.0.02023-02-15

7.0.1 → 8.0.02024-03-12

8.0.0 → 9.0.02025-04-09

9.0.0 → 10.0.02026-03-21

PHP version history (7 changes)1.0.0PHP ~5.6|~7.0

3.0.0PHP ^7.2

5.0.0PHP ^7.4

5.1.0PHP ^7.4|^8.0

6.0.0PHP ^8.0

7.0.0PHP ^8.1

10.0.0PHP ^8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/47768513?v=4)[Kazi Manzur Ahmed](/maintainers/kazimahmed)[@kazimahmed](https://github.com/kazimahmed)

---

Top Contributors

[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (228 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (141 commits)")[![tzsk](https://avatars.githubusercontent.com/u/13273787?v=4)](https://github.com/tzsk "tzsk (91 commits)")[![khanzadimahdi](https://avatars.githubusercontent.com/u/6291970?v=4)](https://github.com/khanzadimahdi "khanzadimahdi (34 commits)")[![srustamov](https://avatars.githubusercontent.com/u/22997563?v=4)](https://github.com/srustamov "srustamov (6 commits)")[![omalizadeh](https://avatars.githubusercontent.com/u/12392549?v=4)](https://github.com/omalizadeh "omalizadeh (5 commits)")[![roshedgostarandev1](https://avatars.githubusercontent.com/u/52368299?v=4)](https://github.com/roshedgostarandev1 "roshedgostarandev1 (4 commits)")[![andvenaa](https://avatars.githubusercontent.com/u/13993996?v=4)](https://github.com/andvenaa "andvenaa (4 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (3 commits)")[![dijonneto](https://avatars.githubusercontent.com/u/6545820?v=4)](https://github.com/dijonneto "dijonneto (2 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (2 commits)")[![matthiez](https://avatars.githubusercontent.com/u/12965261?v=4)](https://github.com/matthiez "matthiez (2 commits)")[![lotfimostafa](https://avatars.githubusercontent.com/u/12979443?v=4)](https://github.com/lotfimostafa "lotfimostafa (1 commits)")[![cedroux](https://avatars.githubusercontent.com/u/2563986?v=4)](https://github.com/cedroux "cedroux (1 commits)")[![EmanueleCoppola](https://avatars.githubusercontent.com/u/12816305?v=4)](https://github.com/EmanueleCoppola "EmanueleCoppola (1 commits)")[![Hebrahimzadeh](https://avatars.githubusercontent.com/u/38420287?v=4)](https://github.com/Hebrahimzadeh "Hebrahimzadeh (1 commits)")[![kopitar](https://avatars.githubusercontent.com/u/19343414?v=4)](https://github.com/kopitar "kopitar (1 commits)")[![alisalehi1380](https://avatars.githubusercontent.com/u/111766206?v=4)](https://github.com/alisalehi1380 "alisalehi1380 (1 commits)")[![mohammadhsn](https://avatars.githubusercontent.com/u/30635428?v=4)](https://github.com/mohammadhsn "mohammadhsn (1 commits)")[![mohaphez](https://avatars.githubusercontent.com/u/20874565?v=4)](https://github.com/mohaphez "mohaphez (1 commits)")

---

Tags

aws-snsclockworkclockwork-smscomposerdriverkavenegarlaravellink-mobilitymelipayamaknexmonexmo-smssms-gatewaysmsirsnstextlocaltwiliolaravelsmstwiliolaravel-smskavenegartzsklaravel sms gatewaymelipayamaksmsirtextlocalfarazsmslink-mobilitytsmssmsgateway24sms gateway me

###  Code Quality

TestsPest

Static AnalysisPHPStan, Psalm

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tzsk-sms/health.svg)

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

###  Alternatives

[laravel/socialite

Laravel wrapper around OAuth 1 &amp; OAuth 2 libraries.

5.7k108.5M884](/packages/laravel-socialite)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M130](/packages/roots-acorn)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)[simplestats-io/laravel-client

Analytics for Laravel. Track visitors, registrations, and payments. Discover which channels actually drive revenue, not just traffic. Server-side, GDPR compliant, ad-blocker proof.

5019.3k](/packages/simplestats-io-laravel-client)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1235.9k20](/packages/fleetbase-core-api)

PHPackages © 2026

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