abduselam/afromessage

PHP SDK for Afro message

v0.3.3 2024-03-29 17:50 UTC

This package is auto-updated.

Last update: 2024-10-29 19:08:23 UTC


README

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

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

Simple usage looks like this

use Afromessage\AfroMessage;

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

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

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 *
  • Example
$response = AfroMessage::send("+251987654321","Hello there",method: "GET");

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 *
  • Example
$response = AfroMessage::code("+251987654321",codeLength: 5, type: 'alphanumeric', postfix: "Is your otp");

verify

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

  1. code.
  • Optional parameters *
  • Example
$response = AfroMessage::verify("23124",recipient: "+251987654321");