Download the PHP package timothydake/nigeriabulksms-sdk without Composer
On this page you can find all versions of the php package timothydake/nigeriabulksms-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download timothydake/nigeriabulksms-sdk
More information about timothydake/nigeriabulksms-sdk
Files in timothydake/nigeriabulksms-sdk
Package nigeriabulksms-sdk
Short Description A production-grade PHP SDK for NigeriaBulkSMS API. Provides SMS sending, voice calls, audio uploads, and data fetching functionality with Laravel integration.
License MIT
Homepage https://github.com/timothydake/nigeriabulksms-sdk
Informations about the package nigeriabulksms-sdk
NigeriaBulkSMS PHP SDK
A production-grade PHP SDK for the NigeriaBulkSMS.com API. This SDK provides a simple, robust, and type-safe way to integrate bulk SMS, voice messaging, and data fetching functionalities into your PHP and Laravel applications.
Features
- 🚀 Easy to use - Simple and intuitive API
- 🛡️ Robust error handling - Comprehensive error types and validation
- 📱 SMS & Voice - Support for text messages, voice calls, and TTS
- 📊 Data fetching - Access to account balance, history, and more
- 📦 Laravel Support - Seamless integration with Laravel applications
Installation
This SDK can be installed via Composer.
Replace your-vendor-name
with your desired vendor name when publishing the package.
Basic Usage (PHP)
First, initialize the NigeriaBulkSMS
client with your username and password.
Laravel Integration
1. Publish the Configuration File
After installing the package, publish the configuration file using the artisan command:
This will create a nigeriabulksms.php
file in your config
directory. You can then set your API credentials in your .env
file:
2. Usage in Laravel
You can use the NigeriaBulkSMS
facade or inject the NigeriaBulkSMS
class directly.
Using the Facade
Using Dependency Injection
API Reference
NigeriaBulkSMS
Client
The main client class to interact with the NigeriaBulkSMS API.
SMS Service
Access SMS functionalities via $client->sms()
.
send(string $message, string $sender, string|array $mobiles)
Sends a text message to one or more mobile numbers.
$message
(string): The content of the SMS message.$sender
(string): The sender ID (max 11 alphanumeric characters).$mobiles
(string|array): A single mobile number or an array of mobile numbers. Numbers should be in international format (e.g.,2348030000000
).
Call Service
Access call functionalities via $client->call()
.
sendTTS(string $message, string $sender, string|array $mobiles)
Sends a Text-to-Speech (TTS) call to one or more mobile numbers.
$message
(string): The text to be converted to speech.$sender
(string): The sender ID.$mobiles
(string|array): A single mobile number or an array of mobile numbers.
sendAudio(string $audioReference, string $sender, string|array $mobiles)
Sends a pre-recorded audio call to one or more mobile numbers using an audio reference.
$audioReference
(string): The reference ID of the uploaded audio file.$sender
(string): The sender ID.$mobiles
(string|array): A single mobile number or an array of mobile numbers.
Audio Service
Access audio functionalities via $client->audio()
.
upload(string $url)
Uploads an audio file from a given URL to the NigeriaBulkSMS platform.
$url
(string): The URL of the audio file (e.g.,https://example.com/audio.mp3
).
Data Fetcher Service
Access data fetching functionalities via $client->dataFetcher()
.
getBalance()
Retrieves the current account balance.
getProfile()
Retrieves the customer profile information.
getContacts()
Retrieves the list of contacts.
getNumbers()
Retrieves the list of saved numbers.
getGroups()
Retrieves the list of groups.
getAudios()
Retrieves the list of saved audio files.
getHistory()
Retrieves the message history.
getScheduled()
Retrieves the list of scheduled messages.
getReports()
Retrieves the delivery reports.
getPayments()
Retrieves the payment history.
Error Handling
The SDK throws NigeriaBulkSMSException
for API-specific errors. You should wrap your API calls in try-catch
blocks to handle these exceptions gracefully.
Common error codes are:
100
: Incomplete request parameters101
: Request denied110
: Login status failed111
: Login status denied150
: Insufficient funds191
: Internal error
For a full list of error codes, refer to the official NigeriaBulkSMS API documentation.
Contributing
Feel free to contribute to this SDK by submitting issues or pull requests on GitHub.
License
This SDK is open-sourced software licensed under the MIT license.
Author: Timothy Dake
- LinkedIn: https://www.linkedin.com/in/timothy-dake-14801571/
- X (formerly Twitter): @timothydake
- Email: [email protected]