PHPackages                             al-saloul/taqnyat - 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. al-saloul/taqnyat

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

al-saloul/taqnyat
=================

Taqnyat SMS Laravel Package

v1.0.1(6mo ago)141.2k1MITPHPPHP ^7.2.5|^8.0

Since Oct 20Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/al-saloul/taqnyat)[ Packagist](https://packagist.org/packages/al-saloul/taqnyat)[ RSS](/packages/al-saloul-taqnyat/feed)WikiDiscussions master Synced 1mo ago

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

Laravel Taqnyat SMS Package
===========================

[](#laravel-taqnyat-sms-package)

[![License: MIT](https://camo.githubusercontent.com/08cef40a9105b6526ca22088bc514fbfdbc9aac1ddbf8d4e6c750e3a88a44dca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75652e737667)](https://opensource.org/licenses/MIT)

Overview
--------

[](#overview)

The Laravel Taqnyat SMS package provides a simple integration with the [Taqnyat SMS API](https://www.taqnyat.sa) to send SMS messages directly from your Laravel application. It includes methods for sending SMS messages, querying your account balance, retrieving available senders, and checking the system status of Taqnyat.

Features
--------

[](#features)

- **Send SMS**: Send SMS messages to multiple recipients.
- **Account Balance**: Retrieve your Taqnyat account balance.
- **Available Senders**: Fetch the list of available sender names.
- **System Status**: Check the current status of the Taqnyat system.
- **Configurable**: Easily configure API authentication and default sender details.

Requirements
------------

[](#requirements)

- PHP &gt;= 7.2.5 (supports PHP 7.2.5 through 8.x)
- Laravel 6.x, 7.x, 8.x, 9.x, 10.x, 11.x, or 12.x
- [GuzzleHttp](https://github.com/guzzle/guzzle) for making HTTP requests.

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

[](#installation)

Install the package via Composer:

```
composer require al-saloul/taqnyat
```

After installing the package, publish the configuration file:

```
php artisan vendor:publish --provider="Alsaloul\Taqnyat\TaqnyatSmsServiceProvider"
```

This command will create the `config/taqnyat-sms.php` configuration file where you can set your API authentication and sender information.

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

[](#configuration)

After publishing the config file, update your `.env` file with your Taqnyat API credentials:

```
TAQNYAT_SMS_AUTH=your_api_key_here
TAQNYAT_SMS_SENDER=your_default_sender_name_here
TAQNYAT_SMS_BASE_URL=https://api.taqnyat.sa
```

### Config Options

[](#config-options)

- **`TAQNYAT_SMS_AUTH`**: Your API key for authentication.
- **`TAQNYAT_SMS_SENDER`**: The default sender name for SMS messages.
- **`TAQNYAT_SMS_BASE_URL`**: The base URL for the Taqnyat API (default is `https://api.taqnyat.sa`).

Usage
-----

[](#usage)

You can use the package by either calling the `TaqnyatSms` facade or injecting the `TaqnyatSms` service into your classes.

### Example: Sending an SMS via Facade

[](#example-sending-an-sms-via-facade)

```
use Alsaloul\Taqnyat\TaqnyatSms;

$response = TaqnyatSms::sendMessage('Hello, this is a test message.', ['966********'], 'SenderName');
return $response;
```

### Example: Injecting `TaqnyatSms` in Controller

[](#example-injecting-taqnyatsms-in-controller)

```
use Alsaloul\Taqnyat\TaqnyatSms;

class SmsController extends Controller
{
    protected $sms;

    public function __construct(TaqnyatSms $sms)
    {
        $this->sms = $sms;
    }

    public function sendSms()
    {
        $body = 'Hello, this is a test message.';
        $recipients = ['966********'];
        $sender = 'SenderName';

        $response = $this->sms->sendMessage($body, $recipients, $sender);
        return response()->json($response);
    }
}
```

### Available Methods

[](#available-methods)

#### 1. Send SMS

[](#1-send-sms)

```
TaqnyatSms::sendMessage($body, $recipients, $sender, $smsId = '', $scheduled = '', $deleteId = '');
```

- **`$body`**: The SMS message content.
- **`$recipients`**: Array of recipient phone numbers.
- **`$sender`**: Sender name (optional, defaults to configured sender).
- **`$smsId`** (optional): Custom SMS ID for tracking purposes.
- **`$scheduled`** (optional): Scheduled date and time for sending the message.
- **`$deleteId`** (optional): ID for message deletion after sending.

#### 2. Get Account Balance

[](#2-get-account-balance)

Retrieve your account balance from Taqnyat:

```
$response = TaqnyatSms::getBalance();
return $response;
```

#### 3. Get Available Senders

[](#3-get-available-senders)

Get the list of available SMS sender names:

```
$response = TaqnyatSms::getSenders();
return $response;
```

#### 4. Check System Status

[](#4-check-system-status)

Check the status of the Taqnyat system:

```
$response = TaqnyatSms::getStatus();
return $response;
```

Handling Errors
---------------

[](#handling-errors)

All methods use Guzzle for HTTP requests and are wrapped in `try-catch` blocks to handle exceptions gracefully. In case of an error, you will receive a descriptive error message which can help in debugging.

### Example: Handling Errors

[](#example-handling-errors)

```
try {
    $response = TaqnyatSms::sendMessage('Hello, this is a test message.', ['966********'], 'SenderName');
    return $response;
} catch (Exception $e) {
    return 'Error: ' . $e->getMessage();
}
```

Changelog
---------

[](#changelog)

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

Contributing
------------

[](#contributing)

Contributions are welcome! If you would like to contribute, please submit a pull request or open an issue for any bugs or feature requests.

### Steps to Contribute

[](#steps-to-contribute)

1. Fork the repository.
2. Create a new branch: `git checkout -b feature-branch`.
3. Make your changes.
4. Submit a pull request.

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT License](LICENSE).

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance67

Regular maintenance activity

Popularity28

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity45

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

Every ~378 days

Total

2

Last Release

191d ago

PHP version history (2 changes)v1.0.0PHP &gt;=7.4

v1.0.1PHP ^7.2.5|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/0a2776dd1dd2c91f8bac075de5cd7c2e9fb7f987083d643c4e3373724b27f542?d=identicon)[al-saloul](/maintainers/al-saloul)

---

Top Contributors

[![al-saloul](https://avatars.githubusercontent.com/u/96193006?v=4)](https://github.com/al-saloul "al-saloul (7 commits)")

### Embed Badge

![Health badge](/badges/al-saloul-taqnyat/health.svg)

```
[![Health](https://phpackages.com/badges/al-saloul-taqnyat/health.svg)](https://phpackages.com/packages/al-saloul-taqnyat)
```

###  Alternatives

[laravel-notification-channels/telegram

Telegram Notifications Channel for Laravel

1.1k3.4M35](/packages/laravel-notification-channels-telegram)[laravel-notification-channels/fcm

FCM (Firebase Cloud Messaging) Notifications Driver for Laravel

5917.0M16](/packages/laravel-notification-channels-fcm)[s-ichikawa/laravel-sendgrid-driver

This library adds a 'sendgrid' mail driver to Laravel.

4139.3M1](/packages/s-ichikawa-laravel-sendgrid-driver)[laravel-notification-channels/microsoft-teams

A Laravel Notification Channel for Microsoft Teams

1603.0M7](/packages/laravel-notification-channels-microsoft-teams)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)[tzsk/sms

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

320244.3k6](/packages/tzsk-sms)

PHPackages © 2026

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