SMS API is a Third Party PHP Library for Short Message Service API
composer require codehub/sms-api<?php
require_once('vendor/autoload.php');
use CodeHub\SMS\Semaphore;
$semaphore = new Semaphore('{API_KEY}', '{SENDER_NAME}'); // Optional SENDER_NAME default to Semaphoreecho $semaphore->send('09123456789', 'Your message here');Response:
[
{
"message_id": 1234567,
"user_id": 12345,
"user": "user@example.com",
"account_id": 54321,
"account": "Your Account Name",
"recipient": "09123456789",
"message": "The message you sent",
"sender_name": "SEMAPHORE",
"network": "Globe",
"status": "Sent",
"type": "Single",
"source": "Api",
"created_at": "0000-00-00 00:00:00",
"updated_at": "0000-00-00 00:00:00"
}
]You can specify up to 1,000 recipients/numbers at a time.
echo $semaphore->send(['09123456789', '09987654321'], 'Your message here');Normally messages are processed in the order they are received and during periods of heavy traffic messaging, messages can be delayed. If your message is time sensitive, you may wish to use our premium priority queue which bypasses the default message queue and sends the message immediately. This service is 2 credits per 160 character SMS.
echo $semaphore->priority('09123456789', 'Your message here');You can retrieve up to 100 sent messages at a time, with support for pagination by passing the optional $page variable:
echo $semaphore->messages(['limit' => 100, 'page' => 3]);Filter by date range:
echo $semaphore->messages(['startDate' => '0000-00-00', 'endDate' => '0000-00-00']);Filter by telco network e.g. "globe", "smart":
echo $semaphore->messages(['network' => 'globe']);Filter by status e.g. "pending", "success":
echo $semaphore->messages(['status' => 'success']);echo $semaphore->account();Response:
{
"account_id": 12345,
"account_name": "Your Organization",
"status": "Active",
"credit_balance": 1000
}echo $semaphore->transactions();echo $semaphore->sendernames();Response:
[
{
"name":"Semaphore",
"status":"Active",
"created":"0000-00-00 00:00:00"
},
{
"name":"Example",
"status":"Active",
"created":"0000-00-00 00:00:00"
}
]echo $semaphore->users();Response:
[
{
"user_id": 12345,
"email": "owner@example.com",
"role": "Owner"
},
{
"user_id": 54321,
"email": "user@example.com",
"role": "User"
}
]