Download the PHP package varaai/varasms without Composer
On this page you can find all versions of the php package varaai/varasms. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package varasms
VaraSMS Laravel Package
A Laravel package for integrating with the VaraSMS messaging service. This package provides an easy way to send SMS messages, manage customer balances, and interact with the VaraSMS API.
Installation
You can install the package via composer:
Configuration
Publish the configuration file:
Add the following environment variables to your .env
file:
For username/password authentication (default):
Or for token-based authentication:
Test Mode
When VARASMS_TEST_MODE
is set to true
, all API calls will be directed to the test endpoints. This is useful for development and testing without sending actual SMS messages.
Example test mode configuration:
Usage
Send a Single SMS
The sendSMS
method supports both single and multiple recipients:
Parameter | Description | Format/Constraints |
---|---|---|
to | Single phone number or array of numbers | Must start with 255 followed by 9 digits |
message | The message to send | String |
senderId | Optional custom sender ID | String |
reference | Optional message reference | String |
Send SMS Response
Send Bulk SMS
Get Delivery Reports
Check Balance
Recharge Customer
Deduct Customer Balance
Get SMS Logs
The getSMSLogs
method supports the following filters:
Filter | Description | Format/Constraints |
---|---|---|
from | Sender ID name | String |
to | Destination phone number | Must start with 255 followed by 9 digits |
sentSince | Lower limit on sending date | Y-m-d format (e.g., 2024-03-01) |
sentUntil | Upper limit on sending date | Y-m-d format (e.g., 2024-03-15) |
limit | Number of records to return | Integer (max 500) |
offset | Number of records to skip | Integer |
reference | Message reference | String |
All filters are optional. You can use any combination of filters to narrow down your search.
SMS Logs Response
Register Sub-Customer (Resellers Only)
The registerSubCustomer
method requires the following parameters:
Parameter | Description | Format/Constraints |
---|---|---|
first_name | Customer's first name | Required string |
last_name | Customer's last name | Required string |
username | Customer's username | Required string |
Customer's email address | Valid email format | |
phone_number | Customer's phone number | Format: 0XXXXXXXXX or 255XXXXXXXXX |
account_type | Type of sub-customer account | Must be either 'Sub Customer' or 'Sub Customer (Reseller)' |
sms_price | Price per SMS for this customer | Positive number |
Sub-Customer Registration Response
Note: This feature is only available for customers in the reseller program.
Response Format
All methods return an array containing the API response. Here are some example responses:
Send SMS Response
Delivery Reports Response
Balance Response
Recharge/Deduct Response
Error Handling
The package throws exceptions when API calls fail. It's recommended to wrap API calls in try-catch blocks:
Testing
The package includes comprehensive tests. To run the tests:
To generate test coverage reports:
Test Environment
For testing your application with VaraSMS, you can use the test mode by setting your base URL to the test endpoint:
Writing Tests
When writing tests for your application that uses VaraSMS, you can mock the VaraSMS facade:
License
The MIT License (MIT). Please see License File for more information.
Schedule SMS Messages
The scheduleSMS
method supports both one-time and recurring message scheduling:
Required Parameters:
Parameter | Description | Format/Constraints |
---|---|---|
to | Recipient phone number | Must start with 255 followed by 9 digits |
message | The message to send | String |
date | Date to send the message | Y-m-d format (e.g., 2024-03-25) |
time | Time to send the message | 24-hour format HH:mm (e.g., 14:30) |
Optional Parameters:
Parameter | Description | Format/Constraints |
---|---|---|
senderId | Custom sender ID | String |
recurring | Array of recurring settings | See below |
Recurring Settings:
Setting | Description | Format/Constraints |
---|---|---|
repeat | Frequency of repetition | Must be 'hourly', 'daily', 'weekly', or 'monthly' |
start_date | Start date for recurring messages | Y-m-d format |
end_date | End date for recurring messages | Y-m-d format |
Schedule SMS Response
Send Multiple Different Messages
The sendMultipleMessages
method allows you to send different messages to different groups of recipients in a single API call:
Parameter | Description | Format/Constraints |
---|---|---|
messages | Array of message objects | Each message must contain 'to' and 'text' |
reference | Optional global reference | String |
Each message in the messages array should have:
to
: Single phone number or array of numbers (must start with 255)text
: The message contentfrom
: Optional sender ID (uses default if not provided)
Multiple Messages Response
All versions of varasms with dependencies
illuminate/support Version ^10.0|^11.0|^12.0
guzzlehttp/guzzle Version ^7.0