lifetimesms/gateway

Lifetimesms sms sending module to send business SMS

1.0.0 2019-11-28 07:14 UTC

This package is auto-updated.

Last update: 2024-04-22 00:51:02 UTC


README

Lifeitmesms laravel package to send single or bulk text and voice sms and for balance inquiry

Installation

composer require lifetimesms/gateway

Laravel 5 and above

Setup

In app/config/app.php add the following :

1- The ServiceProvider to the providers array :

Lifetimesms\Gateway\LifetimesmsServiceProvider::class,

2- The class alias to the aliases array :

'Lifetimesms' =>  Lifetimesms\Gateway\Facades\LifetimesmsFacade::class,

3- Publish the config file

php artisan vendor:publish --tag="lifetimesms"

Configuration

Add LIFETIMESMS_API_TOKEN and LIFETIMESMS_API_SECRET in .env file :

LIFETIMESMS_API_TOKEN=api-token
LIFETIMESMS_API_SECRET=api-secret

Usage

Send Single SMS :

$params = ['to' => '03348090100', 'from' => 'Lifetimesms', 'message' => 'Lifetimesms Testing Laravel Package', 'unicode' => false, 'date' => null, 'time' => null];
$response = Lifetimesms::singleSMS($params);

Send Bulk SMS :

$params = ['to' => ['0334809000', '03008090100', '03448090100'], 'from' => 'Lifetimesms', 'message' => 'Lifetimesms Testing Laravel Package', 'unicode' => false, 'date' => null, 'time' => null];
$response = Lifetimesms::bulkSMS($params);

Send Personalized SMS :

$params = ['data' => [['to' => '03348090100', 'message' => 'Hello david! its from lifetimesms'], ['to' => '03008090100', 'message' => 'Hello peter! its from lifetimesms']], 'from' => 'Lifetimesms', 'date' => null, 'time' => null];
$response = Lifetimesms::personalizedSMS($params);

Send Voice SMS :

$params = ['to' => ['0334809000', '03008090100', '03448090100'], 'from' => 'Lifetimesms', 'voice_id' => '1', 'date' => null, 'time' => null];
$response = Lifetimesms::voiceSMS($params);

Check Delivery Status :

$params = ['message_id' => '44a82f4e3dd9bd7a091c1127'];
$response = Lifetimesms::deliveryStatus($params);

Send Voice Request (File Upload) :

$params = ['title' => 'Sample File For Voice SMS', 'file_path' => 'sample.wav'];
// 'file_path' must be the complete path of the audio file
// Valid extensions are mp3 and wav only
$response = Lifetimesms::createVoiceFromFile($params);

Send Voice Request (Text To Speech) :

$params = ['title' => 'Sample Text For Voice SMS', 'text' => 'Sample text of voice sms.'];
$response = Lifetimesms::createVoiceFromTextToSpeech($params);

Check Voice Status :

$params = ['voice_id' => '1472'];
$response = Lifetimesms::voiceStatus($params);

Balance Inquiry :

$response = Lifetimesms::balanceInquiry();

Network Lookup :

$params = ['phone_number' => '03008090100'];
$response = Lifetimesms::networkLookup($params);