Download the PHP package valinteca-test/localization without Composer
On this page you can find all versions of the php package valinteca-test/localization. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download valinteca-test/localization
More information about valinteca-test/localization
Files in valinteca-test/localization
Package localization
Short Description valinteca test localization
License MIT
Informations about the package localization
Localization package
A composer package from Valinteca that introduces an easy integration with Localization platform for Laravel applications.
Features
- Send SMS messages
- Send personalized messages
- Send & verify OTP codes
- Manage senders
- Message cost calculation
- Balance inquiry
Installation
To publish configurations:
This will publish config file to config/Localization.php
Then add these keys to .env file:
Usage
Send message
to: acccepts number or array of numbers
at: accepts time to send in format "Y-m-d H:i:s" or a Carbon instance
message: acccepts message text
send: performs operation and returns response
Examples
-
with default settings:
-
Custom sender:
Use sender method for custom sender name. If you didn't use this method then default sender name from config/env will be used. -
Multiple numbers:
Pass an array to to method. -
At later time:
Pass datetime to at method. -
Custom options:
Pass options to options method Available options are:1- reqBulkId: to get msg id of the bulk (true or false, default is false)
2- msgEncoding: (UTF8 or windows-1256, default is UTF8)
3- reqFilter: to filter the duplicated numbers (true or false, default is true)
Send personalized messages
Personalized messages are message with different SMS content for each number in array. To send personalized messages use sendPersonalized method with an array of variables for each number.
Message body should contain the message body including the variables that should be between curly brackets {}.
Send test message
You can test Localization API for free . You will get free sms every day . To test service you can send sms using sendTestMessage method.
This method uses predefined sender name and message text. so you will define numbers only.
Balance Inquiry
To inquire about your balance use getBalance method
Get messages
To get messages for bulk ID use forbulkId method with getMessages. The result is paginated and default return is page 1.
To define page number use page method:
To define limit use limit method:
Calculate message cost
Response:
Get user balance
Response: