Download the PHP package itexmo/itexmo-sms without Composer
On this page you can find all versions of the php package itexmo/itexmo-sms. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download itexmo/itexmo-sms
More information about itexmo/itexmo-sms
Files in itexmo/itexmo-sms
Package itexmo-sms
Short Description Itexmo SMS Gateway Integration for Laravel
License MIT
Informations about the package itexmo-sms
Itexmo SMS Gateway for Laravel
Itexmo SMS Gateway Integration for Laravel is a package that allows you to send SMS messages using the Itexmo API in your Laravel applications. It provides a simple and clean API for sending text messages, checking SMS credits, and broadcasting messages to multiple recipients.
Table of Contents
- Installation
- Configuration
- Usage
- Sending SMS
- Checking SMS Balance
- Broadcasting SMS with OTP
- Sending Two-Dimensional Broadcast
- Available Endpoints
- Error Handling
- Testing the Package
Installation
You can install the package via Composer:
After installation, the package will automatically register its service provider and facade.
Configuration
To use the Itexmo package, you need to set up your Itexmo credentials in the Laravel environment configuration file (.env).
Add the following lines to your .env file:
Next, publish the package configuration:
This will create a configuration file config/itexmo.php where you can manage your Itexmo settings.
Usage
Sending SMS
To send an SMS message to a single or multiple recipients, use the broadcast() method provided by the ItexmoSms class.
Example:
Checking SMS Balance
You can check your current SMS balance using the checkBalance() method. This will return the remaining credits in your Itexmo account.
Example:
Broadcasting SMS with OTP
To send OTP (One-Time Password) to a single or multiple recipients, you can use the broadcastOTP() method.
Example:
Sending Two-Dimensional Broadcast
To send multiple messages to different recipients, you can use the broadcast2d() method. This allows you to send different messages to different phone numbers.
Example:
Available Endpoints
-
Broadcast SMS (
broadcast)- Sends an SMS message to multiple recipients.
- Parameters:
recipients(array): An array of phone numbers.message(string): The message to send.
- Example:
-
Check Balance (
query)- Retrieves the current SMS balance for the account.
- Parameters: None
- Example:
-
Broadcast OTP (
broadcast-otp)- Sends an OTP (One-Time Password) to multiple recipients.
- Parameters:
recipients(array): An array of phone numbers.message(string): The OTP message to send.
- Example:
- Two-Dimensional Broadcast (
broadcast-2d)- Sends different messages to different recipients.
- Parameters:
messages(array): A two-dimensional array where each element contains a recipient number and the message.
- Example:
Error Handling
All responses from the Itexmo API are handled within the methods. The responses are returned as arrays with the following keys:
success: Indicates if the request was successful (true or false).message: Contains a description of the result or error.data: Contains the raw API response (if applicable).
You can easily check if a request was successful by checking the success key.
Example:
Testing the Package
You can test the package using Postman or any other API testing tool. Simply set up an endpoint that triggers one of the available methods (e.g., broadcast, checkBalance) and call it via an HTTP request.
Example API Route for SMS Broadcast
Testing via Postman
- URL:
http://your-app-url/send-sms - Method: POST
- Body: application/json
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
License
This package is open-sourced software licensed under the MIT license.
All versions of itexmo-sms with dependencies
guzzlehttp/guzzle Version ^6.5
illuminate/support Version 5.8.*
vlucas/phpdotenv Version ^3.3
laravel/framework Version 5.8.*