masgeek / fuelrod-rest-api-client
Fuelrod REST api package for messaging and other things
Package info
github.com/masgeek/fuelrod-rest-api-client
pkg:composer/masgeek/fuelrod-rest-api-client
2.1.0
2026-05-15 21:38 UTC
Requires
- php: ^8.0
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^6.0 || ^7.5
Requires (Dev)
- phpunit/phpunit: ^11||^12||^13.0
This package is auto-updated.
Last update: 2026-05-23 16:28:51 UTC
README
PHP client library for the Fuelrod messaging API.
Requirements
- PHP 8.2 or higher
- ext-curl, ext-json, ext-mbstring
Installation
composer require masgeek/fuelrod-rest-api-client
Usage
Credential-based authentication
use Fuelrod\Fuelrod; $client = new Fuelrod( username: 'your-username', password: 'your-password', baseUrl: 'https://api.fuelrod.co.ke', );
API key authentication
Pass an API key as the fourth argument. When an API key is provided the user
and password fields are omitted from every request payload.
$client = new Fuelrod( username: 'your-username', password: 'your-password', baseUrl: 'https://api.fuelrod.co.ke', apiKey: 'your-api-key', );
Sending a single SMS
$response = $client->singleSms([ 'to' => '0712345678', // or E.164: '+254712345678' 'message' => 'Hello from Fuelrod!', ]); // $response['status'] === 'success' | 'error' // $response['data'] === decoded response body
Sending a plain SMS
$response = $client->plainSms([ 'to' => '+254712345678', 'message' => 'Hello from Fuelrod!', ]);
Sending a premium SMS
$response = $client->premiumSms([ 'to' => '+254712345678', 'message' => 'Hello from Fuelrod!', ]);
Response shape
Every method returns an associative array:
| Key | Type | Description |
|---|---|---|
status |
string |
"success" on 2xx, "error" on a 4xx client error |
data |
object|string |
Decoded JSON body, or raw string if the body is not JSON |
Server-level errors (5xx, network timeouts) throw GuzzleHttp\Exception\GuzzleException.
Validation errors
FuelrodException (code 422) is thrown when:
tois missing, empty, or not a stringmessageis missing or empty- The phone number does not match
+?[0-9]{7,15}(E.164 or local format)
Phone number format
| Format | Example |
|---|---|
| Local | 0712345678 |
| E.164 | +254712345678 |
Running tests
composer test
License
MIT