PHPackages                             medianasms/php-rest-sdk - 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. medianasms/php-rest-sdk

ActiveLibrary[API Development](/categories/api)

medianasms/php-rest-sdk
=======================

Medianasms REST API client

v1.1.0(6y ago)01.7kBSD-2-ClausePHPPHP &gt;=5.3.3CI failing

Since Feb 12Pushed 5y ago1 watchersCompare

[ Source](https://github.com/medianasms/php-rest-sdk)[ Packagist](https://packagist.org/packages/medianasms/php-rest-sdk)[ Docs](https://github.com/medianasms/php-rest-sdk)[ RSS](/packages/medianasms-php-rest-sdk/feed)WikiDiscussions master Synced 6d ago

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

Mediana SMS php api SDK
=======================

[](#mediana-sms-php-api-sdk)

This repository contains open source PHP client for `mediana_sms` api. Documentation can be found at: .

[![Build Status](https://camo.githubusercontent.com/d52e2f3c2391a5ed929f76dabf882d1a4260a0383913a8b98a738a08fbc9ce95/68747470733a2f2f7472617669732d63692e6f72672f6d656469616e61736d732f7068702d726573742d73646b2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/medianasms/php-rest-sdk)

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

[](#installation)

use with composer:

```
composer require medianasms/php-rest-sdk
```

if you don't want to use composer, you can download it directly :

```
wget https://github.com/medianasms/php-rest-sdk/archive/master.zip
```

Examples
--------

[](#examples)

For using sdk, you have to create a client instance that gives you available methods on API

```
require 'autoload.php';

// you api key that generated from panel
$apiKey = "api-key";

$client = new \Medianasms\Client($apiKey);

...
```

### Credit check

[](#credit-check)

```
# return float64 type credit amount
$credit = $client->getCredit();
```

### Send one to many

[](#send-one-to-many)

For sending sms, obviously you need `originator` number, `recipients` and `message`.

```
$bulkID = $client->send(
    "+9810001",          // originator
    ["98912xxxxxxx"],    // recipients
    "mediana is awesome" // message
);
```

If send is successful, a unique tracking code returned and you can track your message status with that.

### Get message summery

[](#get-message-summery)

```
$bulkID = "message-tracking-code";

$message = $client->get_message($bulkID);

echo $message->status;   // get message status
echo $message->cost;     // get message cost
echo $message->payback;  // get message payback
```

### Get message delivery statuses

[](#get-message-delivery-statuses)

```
$bulkID = "message-tracking-code"

list($statuses, $paginationInfo) = $client->fetchStatuses($bulkID, 0, 10)

// you can loop in messages statuses list
foreach($statuses as status) {
    echo sprintf("Recipient: %s, Status: %s", $status->recipient, $status->status);
}

echo sprintf("Total: ", $paginationInfo->total);
```

### Inbox fetch

[](#inbox-fetch)

fetch inbox messages

```
list($messages, $paginationInfo) = $client->fetchInbox(0, 10);

foreach($messages as $message) {
    echo sprintf("Received message %s from number %s in line %s", $message->message, $message->sender, $message->number);
}
```

### Pattern create

[](#pattern-create)

For sending messages with predefined pattern(e.g. verification codes, ...), you hav to create a pattern. a pattern at least have a parameter. parameters defined with `%param_name%`.

```
$pattern = $client->createPattern("%name% is awesome", False);

echo $pattern->code;
```

### Send with pattern

[](#send-with-pattern)

```
$patternValues = [
    "name" => "Mediana",
];

$bulkID = $client->sendPattern(
    "t2cfmnyo0c",    // pattern code
    "+9810001",      // originator
    "98912xxxxxxx",  // recipient
    $patternValues,  // pattern values
);
```

### Error checking

[](#error-checking)

```
use Medianasms\Errors\Error;
use Medianasms\Errors\HttpException;

try{
    $bulkID = $client->send("9810001", ["98912xxxxx"], "mediana is awesome");
} catch (Error $e) { // mediana error
    var_dump($e->unwrap()); // get real content of error
    echo $e->getCode();

    // error codes checking
    if ($e->code() == ResponseCodes::ErrUnprocessableEntity) {
        echo "Unprocessable entity";
    }
} catch (HttpException $e) { // http error
    var_dump($e->getMessage()); // get stringified error
    echo $e->getCode();
}
```

website:
برای دسترسی به سایر مستندات وب سرویس و زبان های برنامه نویسی سامانه پیام کوتاه مدیانا اس ام اس به لینک زیر مراجعه کنید

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 77.8% 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

Unknown

Total

1

Last Release

2285d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/091af5cd8ac8471cf06335b429371bab946c9f3a14c50cf6d86cd6a5e8a79821?d=identicon)[medianasms](/maintainers/medianasms)

---

Top Contributors

[![bulwarkzero](https://avatars.githubusercontent.com/u/23430573?v=4)](https://github.com/bulwarkzero "bulwarkzero (7 commits)")[![medianasms](https://avatars.githubusercontent.com/u/60349421?v=4)](https://github.com/medianasms "medianasms (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/medianasms-php-rest-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/medianasms-php-rest-sdk/health.svg)](https://phpackages.com/packages/medianasms-php-rest-sdk)
```

###  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)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

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

PHP wrapper for the Meilisearch API

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

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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