PHPackages                             codexoft/mobilesasa-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. codexoft/mobilesasa-sdk

ActiveLibrary[API Development](/categories/api)

codexoft/mobilesasa-sdk
=======================

The Mobilesasa SDK is a PHP library that provides seamless integration with the Mobilesasa API for sending SMS messages, managing contact groups, and conducting mobile surveys. This SDK supports various messaging features including single SMS, bulk SMS, personalized bulk messaging, and delivery status tracking.

v1.0.0(1y ago)014MITPHPPHP &gt;=8.0

Since Jan 18Pushed 1y ago1 watchersCompare

[ Source](https://github.com/codexoft-ke/mobilesasa-sdk)[ Packagist](https://packagist.org/packages/codexoft/mobilesasa-sdk)[ Docs](https://github.com/codexoft/mobilesasa-sdk)[ RSS](/packages/codexoft-mobilesasa-sdk/feed)WikiDiscussions main Synced 1mo ago

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

Mobilesasa SDK Documentation
============================

[](#mobilesasa-sdk-documentation)

The Mobilesasa SDK is a PHP library that provides seamless integration with the Mobilesasa API for sending SMS messages, managing contact groups, and conducting mobile surveys. This SDK supports various messaging features including single SMS, bulk SMS, personalized bulk messaging, and delivery status tracking.

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

[](#table-of-contents)

- [Installation](#installation)
- [Configuration](#configuration)
- [Basic Usage](#basic-usage)
- [Features](#features)
    - [Message Management](#message-management)
    - [Contact Groups](#contact-groups)
    - [Anniversary Groups](#anniversary-groups)
    - [Mobile Surveys](#mobile-surveys)
- [API Reference](#api-reference)
- [Error Handling](#error-handling)

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

[](#installation)

To install the Mobilesasa SDK, use Composer:

```
composer require codexoft/mobilesasa-sdk
```

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

[](#configuration)

Initialize the SDK with your credentials:

```
use Codexoft\MobilesasaSDK\Mobilesasa;

$config = [
    'senderId' => 'YOUR_SENDER_ID',
    'apiKey' => 'YOUR_API_KEY',
    'mobileServeyKey' => 'YOUR_SURVEY_KEY',
    'showBalance' => true, // Optional: Show balance in responses
    'shortCode' => 'YOUR_SHORT_CODE' // Optional: For short code messaging
];

$mobilesasa = new Mobilesasa($config);
```

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

[](#basic-usage)

### Sending a Single SMS

[](#sending-a-single-sms)

```
$response = $mobilesasa->sendSMS('0712345678', 'Hello World!');
```

### Sending Bulk SMS

[](#sending-bulk-sms)

```
$phoneNumbers = ['0712345678', '0723456789'];
$response = $mobilesasa->sendBulkSms($phoneNumbers, 'Hello everyone!');
```

Features
--------

[](#features)

### Message Management

[](#message-management)

#### Phone Number Details

[](#phone-number-details)

Get information about a phone number, including the network provider:

```
$details = $mobilesasa->phoneNumberDetails('0712345678');
```

#### Calculate Message Length

[](#calculate-message-length)

Analyze message length and SMS parts:

```
$messageInfo = $mobilesasa->calculateMessageLength('Your message here');
```

#### Check Delivery Status

[](#check-delivery-status)

Track the delivery status of sent messages:

```
$status = $mobilesasa->smsDeliveryStatus('message_id');
```

#### Personalized Bulk SMS

[](#personalized-bulk-sms)

Send different messages to different recipients:

```
$messageBody = [
    [
        'phone' => '0712345678',
        'message' => 'Hello John!'
    ],
    [
        'phone' => '0723456789',
        'message' => 'Hello Jane!'
    ]
];
$response = $mobilesasa->sendPersonalizedBulkSms($messageBody);
```

### Contact Groups

[](#contact-groups)

#### List Groups

[](#list-groups)

```
$groups = $mobilesasa->smsGroups();
```

#### Add Contact to Group

[](#add-contact-to-group)

```
$contactDetails = [
    'name' => 'John Doe',
    'phone' => '0712345678',
    'email' => 'john@example.com' // Optional
];
$response = $mobilesasa->addToGroup('GROUP_CODE', $contactDetails);
```

#### Remove Contact from Group

[](#remove-contact-from-group)

```
$response = $mobilesasa->deleteFromGroup('GROUP_CODE', '0712345678');
```

### Anniversary Groups

[](#anniversary-groups)

#### List Anniversary Groups

[](#list-anniversary-groups)

```
$groups = $mobilesasa->anniversaryGroups();
```

#### Add Contact to Anniversary Group

[](#add-contact-to-anniversary-group)

```
$contactDetails = [
    'name' => 'John Doe',
    'phone' => '0712345678',
    'date' => '2024-01-01'
];
$response = $mobilesasa->addToAnniversaryGroup('GROUP_CODE', $contactDetails);
```

#### Remove Contact from Anniversary Group

[](#remove-contact-from-anniversary-group)

```
$response = $mobilesasa->deleteFromAnniversaryGroup('GROUP_CODE', '0712345678');
```

### Mobile Surveys

[](#mobile-surveys)

Send mobile surveys to contacts:

```
$contactDetails = [
    'name' => 'John Doe',
    'phone' => '0712345678'
];

// Send immediately
$response = $mobilesasa->mobileServey('SURVEY_ID', $contactDetails);

// Schedule for later
$response = $mobilesasa->mobileServey(
    'SURVEY_ID',
    $contactDetails,
    false,
    '2024-01-20 10:00:00',
    '2024-01-20 18:00:00'
);
```

API Reference
-------------

[](#api-reference)

### Phone Number Format Support

[](#phone-number-format-support)

The SDK automatically handles various phone number formats:

- 9 digits (e.g., '712345678')
- 10 digits with leading zero (e.g., '0712345678')
- 12 digits with country code (e.g., '254712345678')

### Response Format

[](#response-format)

Most methods return an array containing:

- `status`: Boolean indicating success
- `responseCode`: API response code
- `message`: Response message
- Additional data specific to the operation
- `balance`: Account balance (if showBalance is true in config)

Error Handling
--------------

[](#error-handling)

The SDK uses the `MobilesasaException` class for error handling:

```
try {
    $response = $mobilesasa->sendSMS('0712345678', 'Hello World!');
} catch (MobilesasaException $e) {
    echo 'Error: ' . $e->getMessage();
    echo 'Status Code: ' . $e->getStatusCode();
    echo 'Response: ' . print_r($e->getResponse(), true);
}
```

Common exceptions include:

- Invalid phone number format
- Missing required parameters
- API authentication errors
- Network connectivity issues

For detailed API documentation and error codes, please visit the [Mobilesasa API Documentation](https://api.mobilesasa.com/docs).

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance42

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

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

480d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/17ef022dae76b3112f2440fa61132525d3cf85ae31190fd927b6ecbc833a3180?d=identicon)[codexoft](/maintainers/codexoft)

---

Tags

apisdksmsbulk-smsmobilesasamobile-surveyscontact-groups

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/codexoft-mobilesasa-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/codexoft-mobilesasa-sdk/health.svg)](https://phpackages.com/packages/codexoft-mobilesasa-sdk)
```

PHPackages © 2026

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