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

ActiveLibrary[API Development](/categories/api)

jamal13647850/sms-api
=====================

A unified PHP library for sending SMS messages through various Iranian SMS providers

v2.6(3mo ago)02821MITPHPPHP &gt;=8.2

Since Aug 31Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/jamal13647850/sms-api)[ Packagist](https://packagist.org/packages/jamal13647850/sms-api)[ RSS](/packages/jamal13647850-sms-api/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (27)Used By (1)

SMS API Library
===============

[](#sms-api-library)

A comprehensive PHP library for sending SMS messages through various Iranian SMS providers.

[![MIT License](https://camo.githubusercontent.com/08cef40a9105b6526ca22088bc514fbfdbc9aac1ddbf8d4e6c750e3a88a44dca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75652e737667)](LICENSE)[![PHP Version](https://camo.githubusercontent.com/0f16581d1180dbfd4c0e13166ec1267d4ad2f2fab8281ea6d6b284cf5c65d921/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322532422d626c75652e737667)](https://php.net)

Overview
--------

[](#overview)

This package provides a unified interface for sending SMS messages through different SMS gateways/providers in Iran. It follows SOLID principles with a clean architecture pattern that allows you to easily switch between different SMS service providers.

Features
--------

[](#features)

- **Unified Interface**: Use the same code for all SMS providers
- **Type Safety**: Full PHP 8.2+ type declarations with strict types
- **Error Handling**: Comprehensive error handling with detailed messages
- **Phone Number Validation**: Automatic normalization and validation of Iranian phone numbers
- **Pattern/Template Support**: Send SMS using predefined patterns
- **Credit Management**: Check account balance across all providers
- **Modern Architecture**: Abstract base class to reduce code duplication

Supported Providers
-------------------

[](#supported-providers)

ProvidersendSMSPatternCreditReceive SMSStatusFarazSMS✅✅✅❌✅SMS.ir✅✅✅✅✅FaraPayamak✅✅✅✅✅Payamito✅✅✅✅✅MedianaSMS✅✅✅❌❌Elanak (SOAP)✅❌✅✅✅**Melipayamak**✅✅✅✅✅Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- curl extension enabled
- json extension enabled
- soap extension enabled (for Elanak provider)

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

[](#installation)

Install the package via Composer:

```
composer require jamal13647850/sms-api
```

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

[](#configuration)

Copy the example environment file and configure your credentials:

```
cp .env.example .env
```

Edit `.env` and fill in your actual API credentials. **Never commit the `.env` file to version control!**

### Environment Variables

[](#environment-variables)

Required variables for Melipayamak:

```
MELIPAYAMAK_USERNAME=your_username
MELIPAYAMAK_PASSWORD=your_apikey_from_developers_menu
MELIPAYAMAK_FROM_PRIMARY=5000XXXXXXXX
MELIPAYAMAK_FROM_SECONDARY=5000XXXXXXXX
TEST_RECIPIENT_1=0912XXXXXXX
TEST_RECIPIENT_2=0939XXXXXXX
```

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

[](#basic-usage)

```
