PHPackages                             feridev/avanak - 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. feridev/avanak

ActiveLibrary[API Development](/categories/api)

feridev/avanak
==============

A modern, well-tested, PSR-compliant PHP SDK for Avanak SMS API.

03PHP

Since May 6Pushed 1y ago1 watchersCompare

[ Source](https://github.com/farzanehlbf/avanak)[ Packagist](https://packagist.org/packages/feridev/avanak)[ RSS](/packages/feridev-avanak/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Avanak API SDK (Laravel Compatible)
===================================

[](#avanak-api-sdk-laravel-compatible)

This package provides an interface to connect with the **Avanak API** and supports features like voice call sending, OTP delivery, text-to-speech (TTS) generation, managing voice messages, and reporting.

📦 Package Structure
-------------------

[](#-package-structure)

```
Avanak/
├── Contracts/
│   ├── AvanakClientInterface.php      # Main interface for interacting with the Avanak API
│   └── HttpClientInterface.php        # Abstraction layer for the HTTP client (e.g., Guzzle)
│
├── Http/
│   └── AvanakClient.php               # Implementation of AvanakClientInterface
│
├── Services/
│   ├── AccountService.php             # Fetch account status
│   ├── AudioService.php               # Manage audio files (upload, delete, download, details)
│   ├── OtpService.php                 # Send OTP
│   └── TtsService.php                 # Send TTS call, generate TTS, quick send message
│
├── Support/
│   └── GuzzleHttpClient.php           # Guzzle-based implementation of HttpClientInterface

```

🧰 Installation
--------------

[](#-installation)

If installing locally:

```
composer require feridev/avanak
```

Or, add to your `composer.json`:

```
"repositories": [
  {
    "type": "path",
    "url": "./packages/avanak"
  }
],
"require": {
  "feridev/avanak": "*"
}
```

⚙️ Environment Setup
--------------------

[](#️-environment-setup)

In your `.env` file, add the Avanak API token:

```
AVANAK_API_TOKEN=your_avanak_token
```

🧱 Usage
-------

[](#-usage)

### 1. Define the client:

[](#1-define-the-client)

```
use Avanak\Support\GuzzleHttpClient;
use Avanak\Http\AvanakClient;

$httpClient = new GuzzleHttpClient(env('AVANAK_API_TOKEN'));
$client = new AvanakClient($httpClient, 'https://api.avanak.ir');
```

### 2. Use the services:

[](#2-use-the-services)

#### Get account status:

[](#get-account-status)

```
use Avanak\Services\AccountService;

$service = new AccountService($client);
$status = $service->getAccountStatus();
```

#### Send OTP:

[](#send-otp)

```
use Avanak\Services\OtpService;

$service = new OtpService($client);
$response = $service->sendOtp('your_password', 5, '09123456789');
```

#### Generate TTS:

[](#generate-tts)

```
use Avanak\Services\TtsService;

$service = new TtsService($client);
$response = $service->generateTTS('your_password', 'Sample text', 'Message Title');
```

#### Quick send with TTS:

[](#quick-send-with-tts)

```
$response = $service->quickSendWithTTS('your_password', 'Sample text', 'Title', '09123456789');
```

#### Send voice call using existing message ID:

[](#send-voice-call-using-existing-message-id)

```
$response = $service->quickSend('your_password', 1234, '09123456789');
```

#### Get quick send details:

[](#get-quick-send-details)

```
$response = $service->getQuickSend('your_password', 4567);
```

#### Upload audio file:

[](#upload-audio-file)

```
use Avanak\Services\AudioService;

$audioService = new AudioService($client);
$base64Audio = base64_encode(file_get_contents('file.mp3'));
$response = $audioService->uploadAudio($base64Audio, 'your_password', 'Message Title', true);
```

#### Download audio message:

[](#download-audio-message)

```
$response = $audioService->downloadAudioMessage('message_id');
```

#### Get message details:

[](#get-message-details)

```
$response = $audioService->getMessageDetails('message_id');
```

#### Delete audio message:

[](#delete-audio-message)

```
$response = $audioService->deleteAudioMessage('message_id');
```

#### Get all messages:

[](#get-all-messages)

```
$response = $audioService->getMessages();
```

#### Get quick send statistics:

[](#get-quick-send-statistics)

```
$response = $audioService->getQuickSendStatistics('2024-01-01T00:00:00', '2024-12-31T23:59:59');
```

🧪 Testing
---------

[](#-testing)

Automated tests have not been added yet. It is recommended to use Postman or curl for manual request validation.

🔒 Security
----------

[](#-security)

Ensure all sensitive data such as API tokens are stored in the `.env` file and **never committed** to version control.

🧑‍💻 Contributing
----------------

[](#‍-contributing)

Contributions and pull requests to improve this package are welcome!

📜 License
---------

[](#-license)

This package is released under the [MIT License](LICENSE).

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity15

Early-stage or recently created project

 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.

### Community

Maintainers

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

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/feridev-avanak/health.svg)

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

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

265103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)

PHPackages © 2026

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