PHPackages                             ijeyg/larapayamak - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. ijeyg/larapayamak

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ijeyg/larapayamak
=================

A package for all sms panels in iran!

v1.1.1(1mo ago)19MITPHPPHP ^8.2CI passing

Since Feb 14Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/ijeyg/larapayamak)[ Packagist](https://packagist.org/packages/ijeyg/larapayamak)[ Docs](https://github.com/ijeyg/larapayamak)[ GitHub Sponsors]()[ RSS](/packages/ijeyg-larapayamak/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (17)Versions (5)Used By (0)

Larapayamak
===========

[](#larapayamak)

> Unified Laravel SMS package for Iranian providers with clean multi-gateway switching.

[![PHP Version](https://camo.githubusercontent.com/321da254d7b028e4112d043890a9effa7aba0c756e0a42a4ed1894918a452e46/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253545382e322d3737374242343f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://www.php.net/)[![Laravel Version](https://camo.githubusercontent.com/d30025b3aa0c44df5082b8251f415b3c1647e10bb8e8d8e56425bb09ff086c9b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d313025323025374325323031312d4646324432303f6c6f676f3d6c61726176656c266c6f676f436f6c6f723d7768697465)](https://laravel.com/)[![CI](https://camo.githubusercontent.com/5c37d0a2be6007f29445cdf6d69748318823846cbe9d1b06fb3e372b5a3e3472/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f696a6579672f6c617261706179616d616b2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d4349)](https://github.com/ijeyg/larapayamak/actions/workflows/run-tests.yml)[![License](https://camo.githubusercontent.com/784362b26e4b3546254f1893e778ba64616e362bd6ac791991d2c9e880a3a64e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e2e737667)](LICENSE.md)

A lightweight and practical SMS abstraction for Laravel projects that need to switch providers without rewriting business logic.

✨ Key Highlights
----------------

[](#-key-highlights)

- Multi-gateway architecture for Iranian SMS providers
- Runtime gateway switching via `gateway($name)`
- Facade + Dependency Injection support
- Simple SMS and pattern/template SMS APIs
- Laravel package auto-discovery
- Contract-based provider abstraction
- CI-tested quality pipeline (Pest, PHPStan, Pint)

---

Why Larapayamak? 🚀
------------------

[](#why-larapayamak-)

If your application depends on SMS delivery (OTP, notifications, order updates), provider lock-in is risky. Larapayamak gives you one consistent API while keeping provider selection flexible.

---

Features
--------

[](#features)

- ✅ Unified API through `Ijeyg\Larapayamak\Services\SmsService`
- ✅ Facade API through `Ijeyg\Larapayamak\Facades\Larapayamak`
- ✅ Multi-gateway runtime selection via `gateway('provider')`
- ✅ Default gateway from config/env (`SMS_GATEWAY`)
- ✅ Pattern/template messaging support where provider supports it
- ✅ Package auto-discovery (service provider + facade alias)
- ✅ Clean separation using provider contract (`SmsProviderInterface`)
- ✅ Test suite with Pest + architecture checks

---

Supported SMS Gateways
----------------------

[](#supported-sms-gateways)

GatewaySimple SMSPattern SMSNotesSMS.ir (`smsir`)✅✅Uses API token header (`X-API-KEY`)FaraPayamak (`farapayamak`)✅✅Uses Payamak REST endpointsFarazSms (`farazsms`)✅✅Supports recipient array in simple sendMeliPayamak (`melipayamak`)✅✅Uses Payamak REST endpointsNikSms (`niksms`)✅❌Pattern method is not implemented in packagePayamResan (`payamresan`)✅✅Uses API key and token endpoints---

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

[](#installation)

```
composer require ijeyg/larapayamak
```

Laravel auto-discovers:

- `Ijeyg\Larapayamak\LarapayamakServiceProvider`
- Facade alias: `Larapayamak`

---

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

[](#configuration)

Publish config:

```
php artisan vendor:publish --provider="Ijeyg\Larapayamak\LarapayamakServiceProvider" --tag="config"
```

Config file path:

```
config/larapayamak.php

```

---

Environment Variables
---------------------

[](#environment-variables)

Set the default gateway:

```
SMS_GATEWAY=smsir
```

Full example for all gateways:

```
# Default gateway
SMS_GATEWAY=smsir

# SMS.ir
SMSIR_USERNAME=
SMSIR_TOKEN=
SMSIR_LINE=

# FaraPayamak
FARAPAYAMAK_USERNAME=
FARAPAYAMAK_PASSWORD=
FARAPAYAMAK_LINE=

# MeliPayamak
MELIPAYAMAK_USERNAME=
MELIPAYAMAK_PASSWORD=
MELIPAYAMAK_LINE=

# FarazSms
FARAZSMS_USERNAME=
FARAZSMS_PASSWORD=
FARAZSMS_LINE=

# NikSms
NIKSMS_USERNAME=
NIKSMS_PASSWORD=
NIKSMS_LINE=

# PayamResan
PAYAMRESAN_APITOKEN=
```

---

Architecture
------------

[](#architecture)

### Core classes

[](#core-classes)

- `Ijeyg\Larapayamak\Services\SmsService`
- `Ijeyg\Larapayamak\Services\GatewayManager`
- `Ijeyg\Larapayamak\Contracts\SmsProviderInterface`
- `Ijeyg\Larapayamak\Facades\Larapayamak`

### Message flow

[](#message-flow)

1. App code calls `Larapayamak` facade or injected `SmsService`
2. `SmsService` delegates to selected provider
3. Provider sends request through internal HTTP client
4. Package returns `Illuminate\Http\JsonResponse`

---

Basic Usage
-----------

[](#basic-usage)

### 1) Facade usage

[](#1-facade-usage)

```
use Ijeyg\Larapayamak\Facades\Larapayamak;

$response = Larapayamak::sendSimpleMessage('09121111111', 'Hello');
```

```
use Ijeyg\Larapayamak\Facades\Larapayamak;

$response = Larapayamak::sendPatternMessage('09121111111', '1234', [
    'code' => '7788',
]);
```

### 2) Dependency Injection usage

[](#2-dependency-injection-usage)

```
use Ijeyg\Larapayamak\Services\SmsService;

class SmsController
{
    public function send(SmsService $sms)
    {
        return $sms->sendSimpleMessage('09121111111', 'Welcome');
    }
}
```

### 3) Controller example

[](#3-controller-example)

```
