PHPackages                             mdhesari/ghasedak-php - 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. mdhesari/ghasedak-php

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

mdhesari/ghasedak-php
=====================

ghasedak sms gateway package for PHP

00PHP

Since May 1Pushed 3y agoCompare

[ Source](https://github.com/Mdhesari/ghasedak-php)[ Packagist](https://packagist.org/packages/mdhesari/ghasedak-php)[ RSS](/packages/mdhesari-ghasedak-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

 [ ![Logo](g4php.png) ](https://github.com/ghasedakapi/ghasedak-php)

### Ghasedak PHP SDK

[](#ghasedak-php-sdk)

 Easy-to-use SDK for implementing Ghasedak SMS API in your PHP projects.
 [**Explore the docs »**](https://ghasedak.me/php)

 [Web Service Documents](https://ghasedak.me/developers) · [REST API](https://ghasedak.me/docs) . [Report Bug](https://github.com/ghasedakapi/ghasedak-php/issues) · [Request Feature](https://github.com/ghasedakapi/ghasedak-php/issues)

 [![contributors](https://camo.githubusercontent.com/d9c81fe7e43bd0974108b9179e38eb831c5b9ffdb57b3ea52a91f2a7edd86051/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f676861736564616b6170692f676861736564616b2d7068702e737667)](https://github.com/ghasedakapi/ghasedak-php/graphs/contributors) [![forks](https://camo.githubusercontent.com/63b9920183c62f03bdad389bd6f1deabaf6aaa58dbc15a1748d2379f4e90c1de/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f676861736564616b6170692f676861736564616b2d7068702e737667)](https://github.com/ghasedakapi/ghasedak-php/network/members) [![stars](https://camo.githubusercontent.com/71f8654b50d246d66c1ff16d85515986993c1cf2a334a44ed6d1741202d697f0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f676861736564616b6170692f676861736564616b2d7068702e737667)](https://github.com/ghasedakapi/ghasedak-php/stargazers) [![issues](https://camo.githubusercontent.com/4d7696495b8408aeac5c6c02de89e857c215d093cab915a8414fd51286fe12fa/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f676861736564616b6170692f676861736564616b2d7068702e737667)](https://github.com/ghasedakapi/ghasedak-php/issues) [![license](https://camo.githubusercontent.com/784362b26e4b3546254f1893e778ba64616e362bd6ac791991d2c9e880a3a64e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e2e737667)](https://opensource.org/licenses/MIT)

 [English Document](#table-of-contents) | [مستندات فارسی](#table-of-contents-fa)

Table of Contents
-----------------

[](#table-of-contents)

- [Install](#install)
- [Usage](#usage)
    - [Parameters](#parameters)
    - [Example](#example)
- [One-Time Passwords (OTP)](#one-time-passwords-otp)
    - [Parameters](#parameters-1)
    - [Example](#example-1)
- [Licence](#license)

Install
-------

[](#install)

The easiest way to install is by using [Composer](https://getcomposer.org/):

```
composer require ghasedak/php
```

Composer is a dependency manager for PHP which allows you to declare the libraries your project depends on, and it will manage (install/update) them for you. If you are not familiar with Composer, you can read its documentations and download it via [getcomposer.org](https://getcomposer.org/).

Alternatively you can download Ghasedak SDK from [here](https://github.com/ghasedakapi/ghasedak-php/archive/master.zip) and extract it in your project and follow the rest of the instructions below. Also there is an `Example` folder inside the package which you can use to understand the procedure.

usage
-----

[](#usage)

To use the API, you need an API key. To get that you should have a [Ghasedak](https://ghasedak.me) account. Register and get your API key.

Then require the file autoload.php to get all classes and dependencies loaded.

```
require __DIR__ . '/vendor/autoload.php';
```

Create an instance from Ghasedak class with your API key:

```
$api = new \Ghasedak\GhasedakApi( 'your_api_key');
```

Don't forget to change `your_api_key` with the key you have got from your Ghasedak account.

Send a sms:

```
$api->SendSimple(
 "09xxxxxxxxx", // receptor
 "Hello World!", // message
 "3000xxxxx" // choose a line number from your account
);
```

Parameters
----------

[](#parameters)

ParameterRequiredDescriptionTypeExamplemessageYesText to be sentstringHello, World!receptorYesThe number of the recipient(s) of the message (seperated by comma `,`).string09111111111linenumberNoThe number of the sender of the message, which, if not specified, will be selected from your dedicated lines with a higher priority.**`(If you do not have a dedicated line, you must specify the linenumber)`**string5000222senddateNoThe exact date and time of sending the message based on Unix time, if not specified, the message will be sent instantly.string1508144471checkidNoIt is used to set a unique number for each SMS, and after sending the SMS, all the information of the sent message can be received with the `status` method.string2071Example
-------

[](#example)

Here is a sample code for sending SMS. Please note that you must specify `linenumber` if you don't have a dedicated line.

```
require __DIR__ . '/vendor/autoload.php';

try{
 $message = "Hello, World!";
 $lineNumber = null; // If you do not have a dedicated line, you must specify the line number
 $receptor = "09xxxxxxxxx";
 $api = new \Ghasedak\GhasedakApi('api_key');
 $api->SendSimple($receptor,$message,$lineNumber);
}
catch(\Ghasedak\Exceptions\ApiException $e){
 echo $e->errorMessage();
}
catch(\Ghasedak\Exceptions\HttpException $e){
 echo $e->errorMessage();
}
```

One-Time Passwords (OTP)
------------------------

[](#one-time-passwords-otp)

The One-Time-Password (OTP) Interface is used to perform a mobile authentication or to implement Two-Factor-Authentication (2FA).
You can pass up to 10 `param` to `Verify` method;

```
$api->setVerifyType(GhasedakApi::VERIFY_TEXT_TYPE)->Verify(
 "09xxxxxxxxx",  // receptor
 "my-template",  // name of the template which you've created in you account
 "param1",       // parameters (supporting up to 10 parameters)
 "param2",
 "param3");
```

Parameters
----------

[](#parameters-1)

ParameterRequiredDescriptionTypeExamplereceptorYesThe number of the recipient of the message.string09111111111typeYesSet `1` to send text message and `2` to send voice message.intHello, World!templateYesThe title of the template you created in your panel.stringmy-templatecheckidNoIt is used to set a unique number for each SMS, and after sending the SMS, all the information of the sent message can be received with the `status` method.string2071param1YesThe values you enter (You must enter at least one parameter).stringabcdefparam2NoThe values you enter.stringabcdefparam3NoThe values you enter.stringabcdefparam4NoThe values you enter.stringabcdefparam5NoThe values you enter.stringabcdefparam6NoThe values you enter.stringabcdefparam7NoThe values you enter.stringabcdefparam8NoThe values you enter.stringabcdefparam9NoThe values you enter.stringabcdefparam10NoThe values you enter.stringabcdefExample
-------

[](#example-1)

```
require __DIR__ . '/vendor/autoload.php';

try{
 $receptor = "09xxxxxxxxx";
 $type = 1;
 $template = "my-template";
 $param1 = '123456';
 $api = new \Ghasedak\GhasedakApi('api_key');
 $api->Verify($receptor, $type, $template, $param1);
}
catch(\Ghasedak\Exceptions\ApiException $e){
 echo $e->errorMessage();
}
catch(\Ghasedak\Exceptions\HttpException $e){
 echo $e->errorMessage();
}
```

:)

License
-------

[](#license)

Freely distributable under the terms of the [MIT](https://opensource.org/licenses/MIT) license.

فهرست مطالب
------------

[](#فهرست-مطالب-)

- [نصب](#install-fa)
- [استفاده](#usage-fa)
- [پارامترها](#parameters-fa)
- [نمونه کد](#example-fa)

- [رمز عبور یک‌بار مصرف](#otp-fa)
- [پارامترها](#parameters1-fa)
- [نمونه کد](#example1-fa)

- [مجوز](#licence-fa)

نصب
---

[](#نصب)

ساده‌ترین راه برای نصب این پکیج استفاده از Composer است:

```
composer require ghasedak/php
```

[Composer](https://getcomposer.org/) سامانه‌ای برای مدیریت بسته‌های زبان PHP است که به شما امکان مدیریت (نصب / به روزرسانی) پکیج‌های نوشته شده در این زبان را می‌دهد. اگر با کامپوزر آشنایی ندارید، می‌توانید از طریق سایت [getcomposer.org](https://getcomposer.org/) مستندات آن را مطالعه و اقدام به بارگیری و نصب آن کنید.

در صورت عدم تمایل به استفاده از کامپوزر، می‌توانید پکیج Ghasedak PHP را از [اینجا](https://github.com/ghasedakapi/ghasedak-php/archive/master.zip) دانلود کرده و محتویات فایل زیپ را درون پروژه‌ی خود استفاده کنید. همچنین پوشه‌ای با نام `Example` درون پکیج وجود دارد که می‌توانید از آن برای یادگیری استفاده‌ی صحیح از پکیج استفاده کنید.

 نحوه استفاده
--------------

[](#-نحوه-استفاده-)

برای استفاده از این پکیج می‌بایست API key داشته باشید. جهت دریافت ابتدا در [سایت قاصدک](https://`/) ثبت‌نام کنید و از پنل کاربری‌تان API key دریافت کنید.

سپس باید فایل autoload را به پروژه‌ی خود اضافه کنید:

```
require __DIR__ . '/vendor/autoload.php';
```

یک instance از کلاس `Ghasedak` با API key خود بسازید:

```
$api = new \Ghasedak\GhasedakApi( 'your_api_key');
```

به خاطر داشته باشید که `your_api_key` را با کلید دریافتی از حساب قاصدک خود جایگزین کنید.

 پیامک دلخواه‌تان را ارسال کنید:

```
$api->SendSimple(
	"09xxxxxxxxx",  // receptor
	"Hello World!", // message
	"3000xxxxx" 	// choose a line number from your account
 );
```

پارامترها
---------

[](#پارامترها)

پارامتراجباریتوضیحاتنوعمثالmessageبلهمتنی که باید ارسال شود.stringسلام دنیا!receptorبلهشماره گیرنده پیام می باشد.string09111111111linenumberخیرشماره فرستنده پیام می باشد، که اگر قید نشود از بین خطوط اختصاصی شما خط با اولویت بالاتر انتخاب می شود.**`( در صورت نداشتن خط اختصاصی باید linenumber را مشخص نمایید )`**string5000222senddateخیرتاریخ و زمان دقیق ارسال پیام بر اساس Unixtime می باشد که اگر قید نشود در همان لحظه پیام ارسال می شود.string1508144471checkidخیربرای تعیین شماره ای یکتا از طرف کاربر برای هر پیامک به کار می رود و پس از ارسال پیامک می توان با متد `status` کلیه اطلاعات پیام ارسال شده را دریافت کرد.string2071

نمونه کد
--------

[](#نمونه-کد)

 کد زیر نمونه‌ای از متد ارسال تکی پیامک می‌باشد. لطفا توجه کنید که در صورت نداشتن خط اختصاصی می‌بایست حتما `linenumber` را وارد کنید.

```
require __DIR__ . '/vendor/autoload.php';
try{
 $message = "Hello, World!";
 $lineNumber = null; // If you do not have a dedicated line, you must specify the line number
 $receptor = "09xxxxxxxxx";
 $api = new \Ghasedak\GhasedakApi('api_key');
 $api->SendSimple($receptor,$message,$lineNumber);
}
catch(\Ghasedak\Exceptions\ApiException $e){
 echo $e->errorMessage();
}
catch(\Ghasedak\Exceptions\HttpException $e){
 echo $e->errorMessage();
}
```

 رمز عبور یکبار مصرف (OTP)
---------------------------

[](#-رمز-عبور-یکبار-مصرف-otp--)

 رمز عبور یک‌بار مصرف برای اعتبارسنجی از طریق تلفن همراه و یا برای ورود دو مرحله‌ای (2FA) استفاده می‌شود.

با استفاده از متد `Verify` می‌توانید تا سقف 10 `param` را ارسال کنید:

```
$api->setVerifyType(GhasedakApi::VERIFY_TEXT_TYPE)->Verify(
 "09xxxxxxxxx", // receptor
 "my-template", // name of the template which you've created in you account
 "param1",      // parameters (supporting up to 10 parameters)
 "param2",
 "param3");
```

پارامترها
---------

[](#پارامترها-1)

پارامتراجباریتوضیحاتنوعمثالreceptorبلهشماره گیرنده پیام که با ( , ) از هم جدا می شوند.string09111111111typeبلهبرای ارسال پیام متنی عدد `1` و برای ارسال پیام صوتی عدد `2` را وارد کنید.intHello, World!templateبلهعنوان قالبی که در پنل خود ایجاد کرده اید.stringmy-templatecheckidخیربرای تعیین شماره ای یکتا از طرف کاربر برای هر پیامک به کار می رود و پس از ارسال پیامک می توان با متد `status` کلیه اطلاعات پیام ارسال شده را دریافت کردstring2071param1بلهمقادیری که از سمت شما وارد می شود (وارد کردن حداقل 1 مورد اجباری است).stringabcdefparam2خیرمقادیری که از سمت شما وارد می شود.stringabcdefparam3خیرمقادیری که از سمت شما وارد می شود.stringabcdefparam4خیرمقادیری که از سمت شما وارد می شود.stringabcdefparam5خیرمقادیری که از سمت شما وارد می شود.stringabcdefparam6خیرمقادیری که از سمت شما وارد می شود.stringabcdefparam7خیرمقادیری که از سمت شما وارد می شود.stringabcdefparam8خیرمقادیری که از سمت شما وارد می شود.stringabcdefparam9خیرمقادیری که از سمت شما وارد می شود.stringabcdefparam10خیرمقادیری که از سمت شما وارد می شود.stringabcdef

نمونه کد
--------

[](#نمونه-کد-1)

```
require __DIR__ . '/vendor/autoload.php';
try{
 $receptor = "09xxxxxxxxx";
 $type = 1;
 $template = "my-template";
 $param1 = '123456';
 $api = new \Ghasedak\GhasedakApi('api_key');
 $api->Verify($receptor, $type, $template, $param1);
}
catch(\Ghasedak\Exceptions\ApiException $e){
 echo $e->errorMessage();
}
catch(\Ghasedak\Exceptions\HttpException $e){
 echo $e->errorMessage();
}
```

مجوز
----

[](#مجوز)

این پکیج تحت مجوز [MIT](https://opensource.org/licenses/MIT) منتشر شده است.

###  Health Score

13

—

LowBetter than 1% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity22

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/7504d2dd62302fe03079daa3b37a7cb007d7d67d9aacdf8f5128282d4ab15fcc?d=identicon)[mdhesari](/maintainers/mdhesari)

---

Top Contributors

[![ahoseinpour](https://avatars.githubusercontent.com/u/31063471?v=4)](https://github.com/ahoseinpour "ahoseinpour (16 commits)")[![hopeofiran](https://avatars.githubusercontent.com/u/91685701?v=4)](https://github.com/hopeofiran "hopeofiran (10 commits)")[![rasoulrahimii](https://avatars.githubusercontent.com/u/24825810?v=4)](https://github.com/rasoulrahimii "rasoulrahimii (10 commits)")[![dariubs](https://avatars.githubusercontent.com/u/3078072?v=4)](https://github.com/dariubs "dariubs (2 commits)")[![Mdhesari](https://avatars.githubusercontent.com/u/28428724?v=4)](https://github.com/Mdhesari "Mdhesari (2 commits)")[![kavehmoradi](https://avatars.githubusercontent.com/u/44065271?v=4)](https://github.com/kavehmoradi "kavehmoradi (1 commits)")[![fhasheminasab](https://avatars.githubusercontent.com/u/51957222?v=4)](https://github.com/fhasheminasab "fhasheminasab (1 commits)")

### Embed Badge

![Health badge](/badges/mdhesari-ghasedak-php/health.svg)

```
[![Health](https://phpackages.com/badges/mdhesari-ghasedak-php/health.svg)](https://phpackages.com/packages/mdhesari-ghasedak-php)
```

###  Alternatives

[jildertmiedema/laravel-tactician

Tactician for laravel 8+

105.0k](/packages/jildertmiedema-laravel-tactician)

PHPackages © 2026

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