PHP code example of abduselam / afromessage

1. Go to this page and download the library: Download abduselam/afromessage library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

abduselam / afromessage example snippets


use Afromessage\AfroMessage;

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



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


$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);



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




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

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