kickstartph / semaphore-client
A wrapper for accessing the Semaphore SMS API
Installs: 2 471
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 4
Forks: 12
pkg:composer/kickstartph/semaphore-client
Requires
- php: >=5.5.0
- guzzlehttp/guzzle: 6.0.2
This package is not auto-updated.
Last update: 2025-11-13 07:01:44 UTC
README
Semaphore Client is a PHP wrapper for the Semaphore SMS API
Table of Contents
Installation
composer require kickstartph/semaphore-client
Basic Usage
Sending Messages
<?php require_once( 'vendor/autoload.php' ); use Semaphore\SemaphoreClient; $client = new SemaphoreClient( '{YOUR_API_KEY}', '{OPTIONAL_SENDER_NAME}' ); //Sender Name defaults to SEMAPHORE echo $client->send( '09991234567', 'Your message' );
The sender ID can be overridden through the client send command as well:
echo $client->send( '09991234567', 'Your message', '{NEW_SENDER_ID}' );
Bulk messages (to up to 1000 numbers ) can also be sent through the same API call by providing a comma delimited set of numbers:
echo $client->send( '09991234567,09997654321,', 'Your message' );
The response will contain a record for each message sent:
[
{
"message_id": 1234567,
"user_id": 99556,
"user": "user@your.org",
"account_id": 90290,
"account": "Your Account Name",
"recipient": "09991234567",
"message": "The message you sent",
"sender_name": "SEMAPHORE",
"network": "Globe",
"status": "Queued",
"type": "Single",
"source": "Api",
"created_at": "2016-01-01 00:01:01",
"updated_at": "2016-01-01 00:01:01"
}
]
Retrieving Messages
You can retrieve up to 100 sent messages at a time, with support for pagination by passing the optional $page variable:
//Will return the results for page 2 of sent messages echo $client->messages( [ 'limit'=> 100 , 'page' => 2 ] );
####Messages by date range:
//Use any date format str_to_time() supports echo $client->messages( 'startDate' => '2016-10-01, '2016-10-31' );
####Messages by telco network:
//Returns all messages sent to recipients on the Globe network echo $client->messages( ['globe'] );
####Supported Filters for retrieving messages
$options = [ 'limit' => 100, 'page' => 1, 'sendername' => 'SEMAPHORE', 'startDate' => '2016-01-01', 'endDate' => '2016-02-01', 'network' => 'globe', 'status' => 'success' ];
Other functions
Below are other calls you can make: ####Account Information
echo $client->account();
{
"account_id": 12345,
"account_name": "Your Organization",
"status": "Active",
"credit_balance": 5000
}
####Users
echo $account->users();
[
{
"user_id": 12345,
"email": "owner@your.org",
"role": "Owner"
},
{
"user_id": 54321,
"email": "someguy@your.org",
"role": "User"
}
]
####Sender Names
echo $account->sendernames();
[
{
"name":"Semaphore",
"status":"Active",
"created":"2016-01-01 00:00:01"
},
{
"name":"Kickstart",
"status":"Active",
"created":"2016-01-01 00:00:01""
}
]
####Transactions
echo $account->transactions();