PHPackages                             abduselam/afromessage - 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. abduselam/afromessage

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

abduselam/afromessage
=====================

PHP SDK for Afro message

v0.4.0(1y ago)31.6k↓50%1MITPHP

Since Sep 14Pushed 1y ago2 watchersCompare

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

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

Afro Message a Laravel(PHP) SDK
===============================

[](#afro-message-a-laravelphp-sdk)

This SDK provides a convinient access to the Afro message API.

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

[](#installation)

```
composer require abduselam/afromessage
```

- Put your api key and sender id in your .env

```
AFRO_API_KEY=*********

AFRO_SENDER_ID=*********
```

- Publish config file

```
php artisan vendor:publish --tag=afromessage-config
```

Gettig started
--------------

[](#gettig-started)

Simple usage looks like this

```
use Afromessage\AfroMessage;

$response = AfroMessage::send("+251987654321","Hello there");
```

Methods
-------

[](#methods)

This methods provides exactly the same functionality as the actual API of afromessage if you need detail on how it works [browse Afromessage API](https://afromessage.com/developers)

### send

[](#send)

To send a text message to a phone number use this send method *2* Required argument.

> 1. Recipient phone number.
> 2. Message

- Optional parameters \*

ParamaterTypeDescriptionfromstringThe value of the system identifier id if you have subscribed to multiple short codes.senderstringThe value of Sender Name to use for this message. only for verified userstemplateintIndicates the message is a template id rather than the actual messagecallbackstringThe callback URL(GET) you want to receive SMS send progress.methodstringhttp method POST or GET (defuld is POST)- Example

```
$response = AfroMessage::send("+251987654321","Hello there",method: "GET");
```

### Bulk

[](#bulk)

To send a text message to a phone number use this send method *2* Required argument.

> 1. Recipient phone numbers.
> 2. Message

- Optional parameters \*

ParamaterTypeDescriptionfromstringThe value of the system identifier id if you have subscribed to multiple short codes.senderstringThe value of Sender Name to use for this message. only for verified userscampaignintThe name of the campaign given for this bulk send. It will show in the list of campaigns and you can monitor the progress.createCallbackstringour callback URL we will call whenever a message is queued for sending from the batch. This endpoint must be a POST endpoint that takes a JSON body.statusCallbackstringYour usual status callback URL you use for the other endponts. It must be a GET endpoint and we will send message status as it changes states- Example

```
$recipients = [
    "+251987654321",
    '+251912345678',
];
$message = "Hello There";
$from = "IDENTIFIER";
$sender = $sender;
$campaign = $campaign;
$createCallback = $createCallback;
$statusCallback = $statusCallback;

// If you want to send personalized messages to a list of phone numbers.. update the recipients

$recipients = [
    [
        'to' => '251987654321',
        'message' => 'Hello 1',
    ],
    [
        'to' => '251912345678',
        'message' => "Hello 2"
    ],
];

$response = AfroMessage::bulk($recipients, $message, $from, $sender, $campaign, $createCallback, $statusCallback);
```

### code

[](#code)

This method helps you to send a short code Whether you want to send a one time password (OTP) or put in place a two-factor-authentication in your systems.

*1* Required argument.

> 1. Recipient phone number.

- Optional parameters \*

ParamaterTypeDescriptioncodeLengthintThe character length of the security code. Default is 4typestringThe type of code you want to send (numeric, alphanumeric, alphabet). Defult is numerictimeToExpireintThe number of seconds for this code to be expired (defualt 0 which is not expired.)prefixstringA message prefix that you can prepend to the codepostfixstringA message postfix that you can append right after the codespaceBeforeintThe number of empty spaces you want to add between generated code and message prefix.(default is 1)spaceAfterintThe number of empty spaces you want to add between generated code and message postfix.(default is 1)fromstringThe value of the system identifier id if you have subscribed to multiple short codes.senderstringThe value of Sender Name to use for this message. only for verified userscallbackstringThe callback URL(GET) you want to receive SMS send progress.- Example

```
$response = AfroMessage::code("+251987654321",codeLength: 5, type: 'alphanumeric', postfix: "Is your otp");
```

### verify

[](#verify)

Verification method to validate code to the corresponding phone number *1* Required argument.

> 1. code.

- Optional parameters \*

ParamaterTypeDescriptionRecipientstringphone number of the recipient. Either this or verificationCodverificationCodestringThe verification Id you received when sending security codes- Example

```
$response = AfroMessage::verify("23124",recipient: "+251987654321");
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance45

Moderate activity, may be stable

Popularity23

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor1

Top contributor holds 93.3% 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 ~78 days

Recently: every ~136 days

Total

8

Last Release

423d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/966415dad8e8bfdd66ce330010a314fab0e00830b612bd85c1043595957bdc0e?d=identicon)[abduselam1](/maintainers/abduselam1)

---

Top Contributors

[![abduselam1](https://avatars.githubusercontent.com/u/57281126?v=4)](https://github.com/abduselam1 "abduselam1 (14 commits)")[![Nes-cmd](https://avatars.githubusercontent.com/u/65490142?v=4)](https://github.com/Nes-cmd "Nes-cmd (1 commits)")

### Embed Badge

![Health badge](/badges/abduselam-afromessage/health.svg)

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

###  Alternatives

[erag/laravel-pwa

A simple and easy-to-use PWA (Progressive Web App) package for Laravel applications.

16083.3k](/packages/erag-laravel-pwa)[mateusjunges/laravel-invite-codes

This package allows you to easily manage invite codes for your Laravel application.

29166.8k](/packages/mateusjunges-laravel-invite-codes)[amphibee/laravel-pint-pre-commit

Laravel Pint pre-commit hook allow you to analyse your code with the awesome Laravel Pint.

1943.9k](/packages/amphibee-laravel-pint-pre-commit)[owowagency/laravel-resources

A package to develop projects faster.

1112.0k2](/packages/owowagency-laravel-resources)

PHPackages © 2026

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